java.lang.Object
de.powerstat.validation.values.Hostname
- All Implemented Interfaces:
IValueObject,Comparable<Hostname>
Hostname.
Probably DSGVO relevant.
TODO Verify TopLevelDomain
TODO ping ok?
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringEscaped dot.private final StringHostname.private static final PatternHostname by dots regexp.private static final PatternHostname regexp.private static final org.apache.logging.log4j.LoggerLogger.private final StringReverse hostname. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringcheckHostname(String hostname) Check hostname.intCompare with another object.booleanIs equal with another object.booleanexist()Exist hostname.Get reverse hostname string.inthashCode()Calculate hash code.booleanisReachable(int timeout) Is hostname reachable.static HostnameHostname factory.private static StringreverseHostname(String hostname) Reverse hostname.Returns the value of this Hostname as a string.toString()Returns the string representation of this Hostname.
-
Field Details
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGERLogger. -
HOSTNAME_REGEXP
Hostname regexp. -
ESC_DOT
Escaped dot.- See Also:
-
HOSTNAME_BY_DOTS
Hostname by dots regexp. -
hostname
Hostname. -
reverseHostname
Reverse hostname.
-
-
Constructor Details
-
Hostname
Constructor.- Parameters:
hostname- Hostname- Throws:
NullPointerException- if hostname is nullIllegalArgumentException- if hostname is not a hostname
-
-
Method Details
-
checkHostname
Check hostname.- Parameters:
hostname- Hostname- Returns:
- Hostname
-
reverseHostname
Reverse hostname.- Parameters:
hostname- Hostname- Returns:
- Reversed hostname.
-
of
Hostname factory.- Parameters:
hostname- Hostname- Returns:
- Hostname object
-
stringValue
Returns the value of this Hostname as a string.- Specified by:
stringValuein interfaceIValueObject- Returns:
- The text value represented by this object after conversion to type string.
-
getReverseHostname
Get reverse hostname string.- Returns:
- Reverse hostname string
-
exist
public boolean exist()Exist hostname.- Returns:
- true if hostname was found, false otherwise
-
isReachable
public boolean isReachable(int timeout) Is hostname reachable.- Parameters:
timeout- Timeout in milliseconds.- Returns:
- true: Hostname is reachable; false otherwise
-
hashCode
public int hashCode()Calculate hash code. -
equals
Is equal with another object. -
toString
Returns the string representation of this Hostname. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "Hostname[hostname=192.168.0.0]" -
compareTo
Compare with another object.- Specified by:
compareToin interfaceComparable<Hostname>- Parameters:
obj- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-