public final class DnsName extends CacheableDataType implements Comparable<DnsName>
All constructors for this class are private. Creating instances
of DnsName is done via the static valueOf(java.lang.String) methods on
the class. Note that a special value representing "Unresolvable" can be
obtained via the UNRESOLVABLE public field.
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.
Implements the Comparable interface to ensure that a sorted list
of DnsNames is presented in an intuitive order. In particular, case is
ignored, and numeric suffixes are taken into account. Also note that
"Unresolvable" instances are sorted to the end of the list.
For example:
switch1.cup.h3c.com switch1.rose.h3c.com switch3.cup.h3c.com switch3.rose.h3c.com switch4.rose.h3c.com switch13.rose.h3c.com switch14.rose.h3c.com switch22.rose.h3c.com switch23.rose.h3c.com zodiac.rose.h3c.com (Unresolvable DNS Name) (Unresolvable DNS Name) | Modifier and Type | Field and Description |
|---|---|
static DnsName |
UNRESOLVABLE
Our instance that represents an unresolvable DNS name.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(DnsName other)
Overridden to (a) ignore case, and (b) take embedded numbers into
account.
|
boolean |
equals(Object o) |
String |
getDomainName()
Returns the domain name; that is, everything after the first dot.
|
String |
getHostName()
Returns the host name; that is, everything up to (but not including)
the first dot.
|
int |
hashCode() |
boolean |
isUnresolvable()
Returns true if this instance is the "unresolvable" instance.
|
String |
toString() |
static DnsName |
valueOf(String str)
Returns an object that represents the value of the DNS name identified
by the specified string.
|
getRefQ, keyFromBytespublic static final DnsName UNRESOLVABLE
public String getHostName()
public String getDomainName()
public boolean isUnresolvable()
public int compareTo(DnsName other)
UNRESOLVABLE instances will sort to the end.compareTo in interface Comparable<DnsName>other - the other instance we are comparing topublic boolean equals(Object o)
Note that this comparison ignores case.
public static DnsName valueOf(String str)
If the parameter is an empty string ("") then the instance
representing "unresolvable DNS name" is returned instead.
str - the string representation of the DNS nameNullPointerException - if the string is nullCopyright © 2014. All Rights Reserved.