public final class IpDnsPair extends CacheableDataType implements Comparable<IpDnsPair>
IpAddress
and a DnsName
as a pair.
All constructors for this class are private. Creating instances of
IpDnsPair
is done via the static valueOf(com.hp.util.ip.IpAddress, com.hp.util.ip.DnsName)
methods on the
class.
Instances of this class are immutable, making them inherently threadsafe.
This class overrides equals(java.lang.Object)
and hashCode()
so that instances
play nicely with the Collection classes.
This class implements the Comparable
interface to ensure that
a sorted list of pairs is presented in an intuitive order.
Modifier and Type | Method and Description |
---|---|
int |
compareTo(IpDnsPair o)
Delegates our comparable to the IpAddress implementation.
|
boolean |
equals(Object o) |
DnsName |
getDns()
Returns the DNS name.
|
IpAddress |
getIp()
Returns the IP address.
|
int |
hashCode() |
boolean |
hasUnresolvableDnsName()
Returns true if the DNS name stored is an "Unresolvable" instance.
|
String |
toString() |
static IpDnsPair |
valueOf(IpAddress ip)
Returns an
IpDnsPair object that represents the specified
IpAddress and the "unresolvable" DnsName paired together. |
static IpDnsPair |
valueOf(IpAddress ip,
DnsName dns)
Returns an
IpDnsPair object that represents the specified
IpAddress and DnsName paired together. |
static IpDnsPair |
valueOf(String ip)
Calls
valueOf(IpAddress) after converting the
string parameter to an IpAddress instance. |
static IpDnsPair |
valueOf(String ip,
String dns)
Calls
valueOf(IpAddress,DnsName) after converting the string
parameters to their respective data-types. |
getRefQ, keyFromBytes
public IpAddress getIp()
public DnsName getDns()
public boolean hasUnresolvableDnsName()
public int compareTo(IpDnsPair o)
compareTo
in interface Comparable<IpDnsPair>
o
- the other pairpublic static IpDnsPair valueOf(IpAddress ip, DnsName dns)
IpDnsPair
object that represents the specified
IpAddress
and DnsName
paired together.ip
- the ip addressdns
- the dns nameNullPointerException
- if either parameter is nullpublic static IpDnsPair valueOf(String ip, String dns)
valueOf(IpAddress,DnsName)
after converting the string
parameters to their respective data-types.ip
- a string representation of an IP addressdns
- a string representation of a DNS nameNullPointerException
- if either parameter is nullpublic static IpDnsPair valueOf(IpAddress ip)
IpDnsPair
object that represents the specified
IpAddress
and the "unresolvable" DnsName
paired together.
This convenience method is equivalent to invoking:
IpDnsPair p = IpDnsPair.valueOf(ip, DnsName.getUnresolvableInstance());
ip
- the ip addressNullPointerException
- if the parameter is nullpublic static IpDnsPair valueOf(String ip)
valueOf(IpAddress)
after converting the
string parameter to an IpAddress instance.ip
- a string representation of an IP addressNullPointerException
- if the parameter is nullCopyright © 2015. All Rights Reserved.