java.lang.Object
de.powerstat.validation.values.PostalCode
- All Implemented Interfaces:
IValueObject,Comparable<PostalCode>
Address Postal code.
Not DSGVO relevant.
https://en.wikipedia.org/wiki/List_of_postal_codes
https://de.wikipedia.org/wiki/Liste_der_Postleitsysteme
TODO Country specific
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(PostalCode obj) Compare with another object.booleanIs equal with another object.inthashCode()Calculate hash code.static PostalCodePostalCode factory.Returns the value of this PostalCode as a string.toString()Returns the string representation of this PostalCode.
-
Field Details
-
POSTALCODE_REGEXP
Postal code regexp. -
postalCode
Postal code.
-
-
Constructor Details
-
PostalCode
Constructor.- Parameters:
postalCode- Postal code- Throws:
NullPointerException- if postalCode is nullIllegalArgumentException- if postalCode is not a correct postalCode
-
-
Method Details
-
of
PostalCode factory.- Parameters:
postalCode- Postal code- Returns:
- PostalCode object
-
stringValue
Returns the value of this PostalCode as a string.- Specified by:
stringValuein interfaceIValueObject- Returns:
- The text value represented by this object after conversion to type string.
-
hashCode
public int hashCode()Calculate hash code. -
equals
Is equal with another object. -
toString
Returns the string representation of this PostalCode. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "PostalCode[postalCode=28000]" -
compareTo
Compare with another object.- Specified by:
compareToin interfaceComparable<PostalCode>- Parameters:
obj- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-