java.lang.Object
de.powerstat.validation.values.Country
- All Implemented Interfaces:
IValueObject
,Comparable<Country>
Country - ISO 3166-1 codes.
Not DSGVO relevant.
TODO Translations
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Compare with another object.boolean
Is equal with another object.Get country name in english language.int
hashCode()
Calculate hash code.static Country
Country factory.Returns the value of this Country as a ISO 3166-1 string.toString()
Returns the string representation of this Country.
-
Field Details
-
COUNTRY_REGEXP
Country regexp. -
alpha2
Alpha-2 country code.
-
-
Constructor Details
-
Country
Constructor.- Parameters:
alpha2
- Alpha-2 code- Throws:
NullPointerException
- if code is nullIllegalArgumentException
- if code is not a known alpha-2 code
-
-
Method Details
-
of
Country factory.- Parameters:
alpha2
- Alpha-2 code- Returns:
- Country object
-
stringValue
Returns the value of this Country as a ISO 3166-1 string.- Specified by:
stringValue
in interfaceIValueObject
- Returns:
- The text value represented by this object after conversion to type string.
-
getEnglishCountryName
Get country name in english language.- Returns:
- Country name in english language
-
hashCode
public int hashCode()Calculate hash code. -
equals
Is equal with another object. -
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]" -
compareTo
Compare with another object.- Specified by:
compareTo
in interfaceComparable<Country>
- Parameters:
obj
- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-