Class PoBoxNumber

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

public final class PoBoxNumber extends Object implements Comparable<PoBoxNumber>, IValueObject
Address Post office box number. DSGVO relevant.
  • Field Details

    • poBoxNumber

      private final long poBoxNumber
      Post office box number.
  • Constructor Details

    • PoBoxNumber

      private PoBoxNumber(long poBoxNumber)
      Constructor.
      Parameters:
      poBoxNumber - PO box number 1-..
      Throws:
      IndexOutOfBoundsException - When the poBoxNumber is less than 1
  • Method Details

    • of

      public static PoBoxNumber of(long poBoxNumber)
      PoBoxNumber factory.
      Parameters:
      poBoxNumber - PoBox number 1-..
      Returns:
      PoBoxNumber object
    • of

      public static PoBoxNumber of(String value)
      PoBoxNumber factory.
      Parameters:
      value - PoBox number 1-.. string
      Returns:
      PoBoxNumber object
    • longValue

      public long longValue()
      Returns the value of this BFPONumber as a long.
      Returns:
      The numeric value represented by this object after conversion to type long.
    • stringValue

      public String stringValue()
      Returns the value of this PoBoNumber as a string.
      Specified by:
      stringValue in interface IValueObject
      Returns:
      The text value represented by this object after conversion to type string.
    • 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 PoBoxNumber. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "PoBoxNumber[poBoxNumber=4711]"
      Overrides:
      toString in class Object
      Returns:
      String representation of this PoBoxNumber
      See Also:
    • compareTo

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