Class BuildingNr

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

public final class BuildingNr extends Object implements Comparable<BuildingNr>, IValueObject
Address Building number. Possibly DSGVO relevant. TODO optimize constructor/compareTo
  • Field Details

    • BUILDINGNR_REGEXP

      private static final Pattern BUILDINGNR_REGEXP
      Building nr regexp.
    • MAX_KNOWN_BUILDING_NR

      private static final int MAX_KNOWN_BUILDING_NR
      Maximum known building nr in the world.
      See Also:
    • buildingNr

      private final String buildingNr
      Building number.
  • Constructor Details

  • Method Details

    • of

      public static BuildingNr of(String buildingNr)
      BuildingNr factory.
      Parameters:
      buildingNr - Building number
      Returns:
      BuildingNr object
    • stringValue

      public String stringValue()
      Returns the value of this BuildingNr 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 BuildingNr. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "BuildingNr[buildingNr=42]"
      Overrides:
      toString in class Object
      Returns:
      String representation of this BuildingNr
      See Also:
    • compareTo

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