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 String
Escaped dot.private final String
Hostname.private static final Pattern
Hostname by dots regexp.private static final Pattern
Hostname regexp.private static final org.apache.logging.log4j.Logger
Logger.private final String
Reverse hostname. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
checkHostname
(String hostname) Check hostname.int
Compare with another object.boolean
Is equal with another object.boolean
exist()
Exist hostname.Get reverse hostname string.int
hashCode()
Calculate hash code.boolean
isReachable
(int timeout) Is hostname reachable.static Hostname
Hostname factory.private static String
reverseHostname
(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:
stringValue
in 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:
compareTo
in interfaceComparable<Hostname>
- Parameters:
obj
- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-