java.lang.Object
de.powerstat.validation.values.Hostname
All Implemented Interfaces:
IValueObject, Comparable<Hostname>

public final class Hostname extends Object implements Comparable<Hostname>, IValueObject
Hostname. Probably DSGVO relevant. TODO Verify TopLevelDomain TODO ping ok?
  • Field Details

    • LOGGER

      private static final org.apache.logging.log4j.Logger LOGGER
      Logger.
    • HOSTNAME_REGEXP

      private static final Pattern HOSTNAME_REGEXP
      Hostname regexp.
    • ESC_DOT

      private static final String ESC_DOT
      Escaped dot.
      See Also:
    • HOSTNAME_BY_DOTS

      private static final Pattern HOSTNAME_BY_DOTS
      Hostname by dots regexp.
    • hostname

      private final String hostname
      Hostname.
    • reverseHostname

      private final String reverseHostname
      Reverse hostname.
  • Constructor Details

  • Method Details

    • checkHostname

      private static String checkHostname(String hostname)
      Check hostname.
      Parameters:
      hostname - Hostname
      Returns:
      Hostname
    • reverseHostname

      private static String reverseHostname(String hostname)
      Reverse hostname.
      Parameters:
      hostname - Hostname
      Returns:
      Reversed hostname.
    • of

      public static Hostname of(String hostname)
      Hostname factory.
      Parameters:
      hostname - Hostname
      Returns:
      Hostname object
    • stringValue

      public String stringValue()
      Returns the value of this Hostname as a string.
      Specified by:
      stringValue in interface IValueObject
      Returns:
      The text value represented by this object after conversion to type string.
    • getReverseHostname

      public 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.
      Overrides:
      hashCode in class Object
      Returns:
      Hash
      See Also:
    • equals

      public boolean equals(Object obj)
      Is equal with another object.
      Overrides:
      equals in class Object
      Parameters:
      obj - Object
      Returns:
      true when equal, false otherwise
      See Also:
    • toString

      public String 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]"
      Overrides:
      toString in class Object
      Returns:
      String representation of this Hostname
      See Also:
    • compareTo

      public int compareTo(Hostname obj)
      Compare with another object.
      Specified by:
      compareTo in interface Comparable<Hostname>
      Parameters:
      obj - Object to compare with
      Returns:
      0: equal; 1: greater; -1: smaller
      See Also: