java.lang.Object
de.powerstat.validation.values.Address
- All Implemented Interfaces:
IValueObject
,Comparable<Address>
- Direct Known Subclasses:
AddressWithWGS84Position
Address.
DSGVO relevant.
TODO COUNTRYNAME - English country names
TODO vcard, hcard, ldap, vcard+xml -> Data mappings/converter
TODO Get/cache GPS posiion for address
-
Field Summary
FieldsModifier and TypeFieldDescriptionAddress formats for countries.private final BFPONumber
British Forces Post Office number.private final Block
Block.private final BuildingName
Building name.private final BuildingNr
Building number.private final City
City.private final Country
Country.private final Department
Department.private final District
District.private static final String
Address format 1.private static final String
Address format 10.private static final String
Address format 11.private static final String
Address format 12.private static final String
Address format 13.private static final String
Address format 14.private static final String
Address format 15.private static final String
Address format 16.private static final String
Address format 17.private static final String
Address format 18.private static final String
Address format 19.private static final String
Address format 2.private static final String
Address format 20.private static final String
Address format 21.private static final String
Address format 22.private static final String
Address format 23.private static final String
Address format 24.private static final String
Address format 3.private static final String
Address format 4.private static final String
Address format 5.private static final String
Address format 6.private static final String
Address format 7.private static final String
Address format 8.private static final String
Address format 9.private final Lines
Lines 1-5.private final Neighbourhood
Neighbourhood.private static final Pattern
No optinals regexp.private final PoBoxNumber
Post office box number.private final PostalCode
Postal code.private final Province
Province.private final Street
Street.private final SubBuilding
Sub building. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Address
(Country country, PostalCode postalCode, City city, Province province, District district, Street street, BuildingNr buildingNr, BuildingName buildingName, SubBuilding subBuilding, PoBoxNumber poBoxNumber, Department department, Neighbourhood neighbourhood, Block block, BFPONumber bFPONumber, Lines lines) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate static <T extends Comparable<T>>
intcompareField
(T obj1, T obj2) Compare fields.int
Compare with another object.private static <T> boolean
equalField
(T obj1, T obj2) Equal fields.boolean
Is equal with another object.private String
getAddressFormat
(String... vars) Get address format depending on country.Get bFPONumber.getBlock()
Get block.Get buildingName.Get buildingNr.getCity()
Get city.Get country.Get department.Get district.getFormattedAddress
(String recipientName) Get formatted address string.getLines()
Get lines.Get neighbourhood.Get poBoxNumber.Get postalCode.Get province.Get street.Get subBuilding.int
hashCode()
Calculate hash code.static Address
of
(Country country, PostalCode postalCode, City city, Province province, District district, Street street, BuildingNr buildingNr, BuildingName buildingName, SubBuilding subBuilding, PoBoxNumber poBoxNumber, Department department, Neighbourhood neighbourhood, Block block, BFPONumber bFPONumber, Lines lines) Address factory.static Address
Address factory.private String
processBlocks
(String formatStr, String... vars) Process format blocks.Returns the value of this Address as a string.toString()
Returns the string representation of this Address.
-
Field Details
-
ADDRESS_FORMATS
Address formats for countries. -
FORMAT1
Address format 1.- See Also:
-
FORMAT2
Address format 2.- See Also:
-
FORMAT3
Address format 3.- See Also:
-
FORMAT4
Address format 4.- See Also:
-
FORMAT5
Address format 5.- See Also:
-
FORMAT6
Address format 6.- See Also:
-
FORMAT7
Address format 7.- See Also:
-
FORMAT8
Address format 8.- See Also:
-
FORMAT9
Address format 9.- See Also:
-
FORMAT10
Address format 10.- See Also:
-
FORMAT11
Address format 11.- See Also:
-
FORMAT12
Address format 12.- See Also:
-
FORMAT13
Address format 13.- See Also:
-
FORMAT14
Address format 14.- See Also:
-
FORMAT15
Address format 15.- See Also:
-
FORMAT16
Address format 16.- See Also:
-
FORMAT17
Address format 17.- See Also:
-
FORMAT18
Address format 18.- See Also:
-
FORMAT19
Address format 19.- See Also:
-
FORMAT20
Address format 20.- See Also:
-
FORMAT21
Address format 21.- See Also:
-
FORMAT22
Address format 22.- See Also:
-
FORMAT23
Address format 23.- See Also:
-
FORMAT24
Address format 24.- See Also:
-
NOOPTIONALS_REGEXP
No optinals regexp. -
country
Country. -
postalCode
Postal code. -
city
City. -
province
Province. -
district
District. -
street
Street. -
buildingNr
Building number. -
buildingName
Building name. -
subBuilding
Sub building. -
poBoxNumber
Post office box number. -
department
Department. -
neighbourhood
Neighbourhood. -
block
Block. -
bFPONumber
British Forces Post Office number. -
lines
Lines 1-5.
-
-
Constructor Details
-
Address
protected Address(Country country, PostalCode postalCode, City city, Province province, District district, Street street, BuildingNr buildingNr, BuildingName buildingName, SubBuilding subBuilding, PoBoxNumber poBoxNumber, Department department, Neighbourhood neighbourhood, Block block, BFPONumber bFPONumber, Lines lines) Constructor.- Parameters:
country
- CountrypostalCode
- Postal codecity
- Cityprovince
- Provincedistrict
- Districtstreet
- StreetbuildingNr
- Bulding numberbuildingName
- Building namesubBuilding
- Sub buildingpoBoxNumber
- Post office box numberdepartment
- Departmentneighbourhood
- Neighbourhoodblock
- BlockbFPONumber
- British Forces Post Office Numberlines
- Lines 1-5- Throws:
NullPointerException
- When country or some other required field is null.
-
-
Method Details
-
of
public static Address of(Country country, PostalCode postalCode, City city, Province province, District district, Street street, BuildingNr buildingNr, BuildingName buildingName, SubBuilding subBuilding, PoBoxNumber poBoxNumber, Department department, Neighbourhood neighbourhood, Block block, BFPONumber bFPONumber, Lines lines) Address factory.- Parameters:
country
- CountrypostalCode
- Postal codecity
- Cityprovince
- Provincedistrict
- Districtstreet
- StreetbuildingNr
- Bulding numberbuildingName
- Building namesubBuilding
- Sub buildingpoBoxNumber
- Post office box numberdepartment
- Departmentneighbourhood
- Neighbourhoodblock
- BlockbFPONumber
- British Forces Post Office Numberlines
- Lines 1-5- Returns:
- Address object
-
of
Address factory.- Parameters:
value
- country,postalcode,city,province,district,street,buildingnr,buildingname,subbuilding,poboxnumber,department,neighbourhood,block,bfponumber,lines- Returns:
- Address object
-
stringValue
Returns the value of this Address as a string.- Specified by:
stringValue
in interfaceIValueObject
- Returns:
- The text value represented by this object after conversion to type string.
-
hashCode
public int hashCode()Calculate hash code. -
equalField
private static <T> boolean equalField(T obj1, T obj2) Equal fields.- Type Parameters:
T
- Field type- Parameters:
obj1
- Field 1 (this)obj2
- Field 2 (other)- Returns:
- true: equal; false: not equal
-
equals
Is equal with another object. -
toString
Returns the string representation of this Address. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "Address[country=DE, postalCode=28000, city=Bremen, province=, district=, street=Hemelinger Heerstr., buildingNr=4711, buildingName=Rathaus, subBuiding=Floor 13, Apart. 0815, poBoxNumber=4711, department=Research, neighbourhood=, block=A, bFPONumber=2, lines=]" -
compareField
Compare fields.- Type Parameters:
T
- Field type- Parameters:
obj1
- Field 1 (this)obj2
- Field 2 (other)- Returns:
- 0: equal; 1 field 1 greater than field 2; -1 field 1 smaller than field 2
-
compareTo
Compare with another object.- Specified by:
compareTo
in interfaceComparable<Address>
- Parameters:
obj
- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-
processBlocks
Process format blocks.- Parameters:
formatStr
- Format stringvars
- Format variables (16) 01: COUNTRYNAME 02: Company 03: POSTALCODE 04: City 05: Province 06: District 07: Street 08: BuildingNumber 09: BuildingName 10: SubBuilding 11: PoBoxNumber 12: Department 13: Neighbourhood 14: Block 15: BFPONUMBER 16: Line1-5- Returns:
- Format with removed blocks for non existing parameters
-
getAddressFormat
Get address format depending on country.- Parameters:
vars
- 16 Strings- Returns:
- Java formatter string 01: COUNTRYNAME 02: Company 03: POSTALCODE 04: City 05: Province 06: District 07: Street 08: BuildingNumber 09: BuildingName 10: SubBuilding 11: PoBoxNumber 12: Department 13: Neighbourhood 14: Block 15: BFPONUMBER 16: Line1-5
-
getFormattedAddress
Get formatted address string.- Parameters:
recipientName
- Company or person name- Returns:
- Formatted address string
- Throws:
NullPointerException
- If recipientName is null
-
getCountry
Get country.- Returns:
- The country
-
getPostalCode
Get postalCode.- Returns:
- The postalCode
-
getCity
Get city.- Returns:
- The city
-
getProvince
Get province.- Returns:
- The province
-
getDistrict
Get district.- Returns:
- The district
-
getStreet
Get street.- Returns:
- The street
-
getBuildingNr
Get buildingNr.- Returns:
- The buildingNr
-
getBuildingName
Get buildingName.- Returns:
- The buildingName
-
getSubBuilding
Get subBuilding.- Returns:
- The subBuilding
-
getPoBoxNumber
Get poBoxNumber.- Returns:
- The poBoxNumber
-
getDepartment
Get department.- Returns:
- The department
-
getNeighbourhood
Get neighbourhood.- Returns:
- The neighbourhood
-
getBlock
Get block.- Returns:
- The block
-
getBFPONumber
Get bFPONumber.- Returns:
- The bFPONumber
-
getLines
Get lines.- Returns:
- The lines
-