1
2
3
4
5 package javax.jmdns.impl;
6
7 import javax.jmdns.JmDNS;
8 import javax.jmdns.ServiceEvent;
9 import javax.jmdns.ServiceInfo;
10
11
12
13
14
15
16
17
18
19 public class ServiceEventImpl extends ServiceEvent {
20
21
22
23 private static final long serialVersionUID = 7107973622016897488L;
24
25
26
27
28 private final String _type;
29
30
31
32 private final String _name;
33
34
35
36 private final ServiceInfo _info;
37
38
39
40
41
42
43
44
45
46
47
48
49
50 public ServiceEventImpl(JmDNSImpl jmDNS, String type, String name, ServiceInfo info) {
51 super(jmDNS);
52 this._type = type;
53 this._name = name;
54 this._info = info;
55 }
56
57
58
59
60
61 @Override
62 public JmDNS getDNS() {
63 return (JmDNS) getSource();
64 }
65
66
67
68
69
70 @Override
71 public String getType() {
72 return _type;
73 }
74
75
76
77
78
79 @Override
80 public String getName() {
81 return _name;
82 }
83
84
85
86
87
88 @Override
89 public String toString() {
90 StringBuilder buf = new StringBuilder();
91 buf.append("[" + this.getClass().getSimpleName() + "@" + System.identityHashCode(this) + " ");
92 buf.append("\n\tname: '");
93 buf.append(this.getName());
94 buf.append("' type: '");
95 buf.append(this.getType());
96 buf.append("' info: '");
97 buf.append(this.getInfo());
98 buf.append("']");
99
100
101
102 return buf.toString();
103 }
104
105
106
107
108
109 @Override
110 public ServiceInfo getInfo() {
111 return _info;
112 }
113
114
115
116
117
118 @Override
119 public ServiceEventImpl clone() {
120 ServiceInfoImpl newInfo = new ServiceInfoImpl(this.getInfo());
121 return new ServiceEventImpl((JmDNSImpl) this.getDNS(), this.getType(), this.getName(), newInfo);
122 }
123
124 }