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

public final class Country extends Object implements Comparable<Country>, IValueObject
Country - ISO 3166-1 codes. Not DSGVO relevant. TODO Translations
  • Field Details

    • COUNTRY_REGEXP

      private static final Pattern COUNTRY_REGEXP
      Country regexp.
    • alpha2

      private final String alpha2
      Alpha-2 country code.
  • Constructor Details

  • Method Details

    • of

      public static Country of(String alpha2)
      Country factory.
      Parameters:
      alpha2 - Alpha-2 code
      Returns:
      Country object
    • stringValue

      public String stringValue()
      Returns the value of this Country as a ISO 3166-1 string.
      Specified by:
      stringValue in interface IValueObject
      Returns:
      The text value represented by this object after conversion to type string.
    • getEnglishCountryName

      public String getEnglishCountryName()
      Get country name in english language.
      Returns:
      Country name in english language
    • 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 Country. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "Country[alpha=DE]"
      Overrides:
      toString in class Object
      Returns:
      String representation of this Country
      See Also:
    • compareTo

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