Class Address

  • All Implemented Interfaces:
    java.io.Serializable

    public class Address
    extends java.lang.Object
    implements java.io.Serializable
    Address of creditor or debtor.

    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.

    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Address.Type
      Address type
    • Constructor Summary

      Constructors 
      Constructor Description
      Address()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clears all fields and set the type to Address.Type.UNDETERMINED.
      boolean equals​(java.lang.Object o)
      java.lang.String getAddressLine1()
      Gets the address line 1
      java.lang.String getAddressLine2()
      Gets the address line 2
      java.lang.String getCountryCode()
      Gets the two-letter ISO country code.
      java.lang.String getHouseNo()
      Gets the house or building number.
      java.lang.String getName()
      Gets the name, either the first and last name of a natural person or the company name of a legal person.
      java.lang.String getPostalCode()
      Gets the postal code
      java.lang.String getStreet()
      Gets the street.
      java.lang.String getTown()
      Gets the town.
      Address.Type getType()
      Gets the address type.
      int hashCode()
      void setAddressLine1​(java.lang.String addressLine1)
      Sets the address line 1.
      void setAddressLine2​(java.lang.String addressLine2)
      Sets the address line 2.
      void setCountryCode​(java.lang.String countryCode)
      Sets the two-letter ISO country code
      void setHouseNo​(java.lang.String houseNo)
      Sets the house or building number.
      void setName​(java.lang.String name)
      Sets the name, either the first and last name of a natural person or the company name of a legal person.
      void setPostalCode​(java.lang.String postalCode)
      Sets the postal code
      void setStreet​(java.lang.String street)
      Sets the street.
      void setTown​(java.lang.String town)
      Sets the town
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Address

        public Address()
    • Method Detail

      • getType

        public Address.Type 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

        public java.lang.String 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

        public void setName​(java.lang.String name)
        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

        public java.lang.String getAddressLine1()
        Gets the address line 1

        Address line 1 contains street name, house number or P.O. box.

        This field is only used for combined elements addresses and is optional.

        Returns:
        address line 1
      • setAddressLine1

        public void setAddressLine1​(java.lang.String addressLine1)
        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 already Address.Type.STRUCTURED, in which case it becomes Address.Type.CONFLICTING.

        This field is only used for combined elements addresses and is optional.

        Parameters:
        addressLine1 - address line 1
      • getAddressLine2

        public java.lang.String getAddressLine2()
        Gets the address line 2

        Address line 2 contains postal code and town.

        This field is only used for combined elements addresses. For this type, it's mandatory.

        Returns:
        address line 2
      • setAddressLine2

        public void setAddressLine2​(java.lang.String addressLine2)
        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 already Address.Type.STRUCTURED, in which case it becomes Address.Type.CONFLICTING.

        This field is only used for combined elements addresses. For this type, it's mandatory.

        Parameters:
        addressLine2 - address line 2
      • getStreet

        public java.lang.String getStreet()
        Gets the street.

        This field is only used for structured addresses and is optional.

        Returns:
        the street
      • setStreet

        public void setStreet​(java.lang.String street)
        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 already Address.Type.COMBINED_ELEMENTS, in which case it becomes Address.Type.CONFLICTING.

        This field is only used for structured addresses and is optional.

        Parameters:
        street - the street
      • getHouseNo

        public java.lang.String getHouseNo()
        Gets the house or building number.

        This field is only used for structured addresses and is optional.

        Returns:
        the house number
      • getPostalCode

        public java.lang.String getPostalCode()
        Gets the postal code

        This field is only used for structured addresses. For this type, it's mandatory.

        Returns:
        the postal code
      • setPostalCode

        public void setPostalCode​(java.lang.String postalCode)
        Sets the postal code

        Setting this field sets the address type to Address.Type.STRUCTURED unless it's already Address.Type.COMBINED_ELEMENTS, in which case it becomes Address.Type.CONFLICTING.

        This field is only used for structured addresses. For this type, it's mandatory.

        Parameters:
        postalCode - the postal code
      • getTown

        public java.lang.String getTown()
        Gets the town.

        This field is only used for structured addresses. For this type, it's mandatory.

        Returns:
        the town
      • getCountryCode

        public java.lang.String getCountryCode()
        Gets the two-letter ISO country code.
        Returns:
        the ISO country code
      • setCountryCode

        public void setCountryCode​(java.lang.String countryCode)
        Sets the two-letter ISO country code

        The country code is mandatory unless the entire address contains null or empty values.

        Parameters:
        countryCode - the ISO country code
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object