javax.jmdns.impl.NetworkTopologyEventImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmdns Show documentation
Show all versions of jmdns Show documentation
JmDNS is a Java implementation of multi-cast DNS and can be used for service registration and discovery in local area networks. JmDNS is fully compatible with Apple's Bonjour.
The project was originally started in December 2002 by Arthur van Hoff at Strangeberry.
The newest version!
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package javax.jmdns.impl;
import java.net.InetAddress;
import javax.jmdns.JmDNS;
import javax.jmdns.NetworkTopologyEvent;
import javax.jmdns.NetworkTopologyListener;
/**
* @author Cédrik Lime, Pierre Frisch
*/
public class NetworkTopologyEventImpl extends NetworkTopologyEvent implements Cloneable {
/**
*
*/
private static final long serialVersionUID = 1445606146153550463L;
private final InetAddress _inetAddress;
/**
* Constructs a Network Topology Event.
*
* @param jmDNS
* @param inetAddress
* @exception IllegalArgumentException
* if source is null.
*/
public NetworkTopologyEventImpl(JmDNS jmDNS, InetAddress inetAddress) {
super(jmDNS);
this._inetAddress = inetAddress;
}
NetworkTopologyEventImpl(NetworkTopologyListener jmmDNS, InetAddress inetAddress) {
super(jmmDNS);
this._inetAddress = inetAddress;
}
/*
* (non-Javadoc)
* @see javax.jmdns.NetworkTopologyEvent#getDNS()
*/
@Override
public JmDNS getDNS() {
return (this.getSource() instanceof JmDNS ? (JmDNS) getSource() : null);
}
/*
* (non-Javadoc)
* @see javax.jmdns.NetworkTopologyEvent#getInetAddress()
*/
@Override
public InetAddress getInetAddress() {
return _inetAddress;
}
@Override
public String toString() {
// .append("' source: ")
// .append("\n\t" + source + "")
// .append("\n]");
return '[' + this.getClass().getSimpleName() + '@' + System.identityHashCode(this) +
"\n\tinetAddress: '" +
this.getInetAddress() +
"']";
}
/*
* (non-Javadoc)
* @see java.lang.Object#clone()
*/
@Override
public NetworkTopologyEventImpl clone() throws CloneNotSupportedException {
return new NetworkTopologyEventImpl(getDNS(), getInetAddress());
}
}