Class Address
- All Implemented Interfaces:
Serializable
You can either set street, house number, postal code and town (type structured address) or address line 1 and 2 (type combined address elements). The type is automatically set once any of these fields is set. Before setting the fields, the address type is undetermined. If fields of both types are set, the address type becomes conflicting. Name and country code must always be set unless all fields are empty.
Banks will no longer accept payments using the combined address elements starting November 21, 2025. Therefore, it is recommended to use structured addresses immediately.
- See Also:
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears all fields and set the type toAddress.Type.UNDETERMINED
.boolean
Deprecated.Use a structured address instead.Deprecated.Use a structured address instead.Gets the two-letter ISO country code.Gets the house or building number.getName()
Gets the name, either the first and last name of a natural person or the company name of a legal person.Gets the postal codeGets the street.getTown()
Gets the town.getType()
Gets the address type.int
hashCode()
void
setAddressLine1
(String addressLine1) Deprecated.Use a structured address instead.void
setAddressLine2
(String addressLine2) Deprecated.Use a structured address instead.void
setCountryCode
(String countryCode) Sets the two-letter ISO country codevoid
setHouseNo
(String houseNo) Sets the house or building number.void
Sets the name, either the first and last name of a natural person or the company name of a legal person.void
setPostalCode
(String postalCode) Sets the postal codevoid
Sets the street.void
Sets the towntoString()
-
Constructor Details
-
Address
public Address()Creates an empty address.
-
-
Method Details
-
getType
Gets the address type.The address type is automatically set by either setting street / house number or address line 1 and 2. Before setting the fields, the address type is undetermined. If fields of both types are set, the address type becomes conflicting.
The address type can be reset by calling
clear()
.- Returns:
- address type
-
getName
Gets the name, either the first and last name of a natural person or the company name of a legal person.- Returns:
- the name
-
setName
Sets the name, either the first and last name of a natural person or the company name of a legal person.The name is mandatory unless the entire address contains
null
or empty values.- Parameters:
name
- the name
-
getAddressLine1
Deprecated.Use a structured address instead. Will be removed in release 4.Gets the address line 1Address line 1 contains street name, house number or P.O. box.
This field is only used for combined address elements and is optional. Starting November 25, 2025, banks will no longer accept payments using combined address elements.
- Returns:
- address line 1
-
setAddressLine1
Deprecated.Use a structured address instead. Will be removed in release 4.Sets the address line 1.Address line 1 contains street name, house number or P.O. box.
Setting this field sets the address type to
Address.Type.COMBINED_ELEMENTS
unless it's alreadyAddress.Type.STRUCTURED
, in which case it becomesAddress.Type.CONFLICTING
.This field is only used for combined address elements and is optional. Starting November 25, 2025, banks will no longer accept payments using combined address elements.
- Parameters:
addressLine1
- address line 1
-
getAddressLine2
Deprecated.Use a structured address instead. Will be removed in release 4.Gets the address line 2Address line 2 contains postal code and town.
This field is only used for combined address elements. For this type, it's mandatory. Starting November 25, 2025, banks will no longer accept payments using combined address elements.
- Returns:
- address line 2
-
setAddressLine2
Deprecated.Use a structured address instead. Will be removed in release 4.Sets the address line 2.Address line 2 contains postal code and town
Setting this field sets the address type to
Address.Type.COMBINED_ELEMENTS
unless it's alreadyAddress.Type.STRUCTURED
, in which case it becomesAddress.Type.CONFLICTING
.This field is only used for combined address elements. For this type, it's mandatory. Starting November 25, 2025, banks will no longer accept payments using combined address elements.
- Parameters:
addressLine2
- address line 2
-
getStreet
Gets the street.This field is only used for structured addresses and is optional.
- Returns:
- the street
-
setStreet
Sets the street.This field must not contain the house or building number.
Setting this field sets the address type to
Address.Type.STRUCTURED
unless it's alreadyAddress.Type.COMBINED_ELEMENTS
, in which case it becomesAddress.Type.CONFLICTING
.This field is only used for structured addresses and is optional.
- Parameters:
street
- the street
-
getHouseNo
Gets the house or building number.This field is only used for structured addresses and is optional.
- Returns:
- the house number
-
setHouseNo
Sets the house or building number.Setting this field sets the address type to
Address.Type.STRUCTURED
unless it's alreadyAddress.Type.COMBINED_ELEMENTS
, in which case it becomesAddress.Type.CONFLICTING
.This field is only used for structured addresses and is optional.
- Parameters:
houseNo
- the house number
-
getPostalCode
Gets the postal codeThis field is only used for structured addresses. For this type, it's mandatory.
- Returns:
- the postal code
-
setPostalCode
Sets the postal codeSetting this field sets the address type to
Address.Type.STRUCTURED
unless it's alreadyAddress.Type.COMBINED_ELEMENTS
, in which case it becomesAddress.Type.CONFLICTING
.This field is only used for structured addresses. For this type, it's mandatory.
- Parameters:
postalCode
- the postal code
-
getTown
Gets the town.This field is only used for structured addresses. For this type, it's mandatory.
- Returns:
- the town
-
setTown
Sets the townSetting this field sets the address type to
Address.Type.STRUCTURED
unless it's alreadyAddress.Type.COMBINED_ELEMENTS
, in which case it becomesAddress.Type.CONFLICTING
.This field is only used for structured addresses. For this type, it's mandatory.
- Parameters:
town
- the town
-
getCountryCode
Gets the two-letter ISO country code.- Returns:
- the ISO country code
-
setCountryCode
Sets the two-letter ISO country codeThe country code is mandatory unless the entire address contains
null
or empty values.- Parameters:
countryCode
- the ISO country code
-
clear
public void clear()Clears all fields and set the type toAddress.Type.UNDETERMINED
. -
equals
-
hashCode
public int hashCode() -
toString
-