1
2
3
4 package javax.jmdns.impl;
5
6 import java.net.InetAddress;
7
8 import javax.jmdns.JmDNS;
9 import javax.jmdns.NetworkTopologyEvent;
10 import javax.jmdns.NetworkTopologyListener;
11
12
13
14
15 public class NetworkTopologyEventImpl extends NetworkTopologyEvent implements Cloneable {
16
17
18
19
20 private static final long serialVersionUID = 1445606146153550463L;
21
22 private final InetAddress _inetAddress;
23
24
25
26
27
28
29
30
31
32 public NetworkTopologyEventImpl(JmDNS jmDNS, InetAddress inetAddress) {
33 super(jmDNS);
34 this._inetAddress = inetAddress;
35 }
36
37 NetworkTopologyEventImpl(NetworkTopologyListener jmmDNS, InetAddress inetAddress) {
38 super(jmmDNS);
39 this._inetAddress = inetAddress;
40 }
41
42
43
44
45
46 @Override
47 public JmDNS getDNS() {
48 return (this.getSource() instanceof JmDNS ? (JmDNS) getSource() : null);
49 }
50
51
52
53
54
55 @Override
56 public InetAddress getInetAddress() {
57 return _inetAddress;
58 }
59
60 @Override
61 public String toString() {
62 StringBuilder buf = new StringBuilder();
63 buf.append("[" + this.getClass().getSimpleName() + "@" + System.identityHashCode(this) + " ");
64 buf.append("\n\tinetAddress: '");
65 buf.append(this.getInetAddress());
66 buf.append("']");
67
68
69
70 return buf.toString();
71 }
72
73
74
75
76
77 @Override
78 public NetworkTopologyEventImpl clone() throws CloneNotSupportedException {
79 return new NetworkTopologyEventImpl(getDNS(), getInetAddress());
80 }
81
82 }