com.verisign.epp.codec.contact

## Class EPPContactAddress

- java.lang.Object
- - com.verisign.epp.codec.contact.EPPContactAddress

- All Implemented Interfaces:
    EPPCodecComponent, java.io.Serializable, java.lang.Cloneable

      public class EPPContactAddress
      extends java.lang.Object
      implements EPPCodecComponent

  Represents a contact address specified in `EPPContactCreateCmd`, `EPPContactUpdateCmd`, or `EPPContactInfoResp`. Every contact has associated postal address information. A postal address contains OPTIONAL street information, city information, OPTIONAL state/province information, an OPTIONAL postal code, and a country identifier as described in [ISO11180]. Address information MAY be provided in both a subset of UTF-8 [RFC2279] that can be represented in 7-bit ASCII [US-ASCII] and unrestricted UTF-8. A contact address is defined as the following in the EPP Contact Mapping Specification:
  A <contact:addr> element that contains address information associated with the contact. A <contact:addr> element contains the following child elements:
  - OPTIONAL <contact:street> elements (up to a maximum of three) that contain the contact's street address. Use `getStreets` and `setStreets` to get and set the elements.
  - A <contact:city> element that contains the contact's city. Use `getCity` and `setCity` to get and set the element.
  - A <contact:sp> element that contains the contact's state or province. This element is OPTIONAL for addressing schemes that do not require a state or province name. Use `getStateProvince` and `setStateProvince` to get and set the element.
  - An OPTIONAL <contact:pc> element that contains the contact's postal code. Use `getPostalCode` and `setPostalCode` to get and set the element.
  - A <contact:cc> element that contains the two-character identifier representing with the contact's country. Use `getCountry` and `setCountry` to get and set the element.
  See Also:
    `EPPContactCreateCmd`, `EPPContactUpdateCmd`, `EPPContactInfoResp`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EPPContactAddress()` Default constructor for `EPPContactAddress`.
    `EPPContactAddress(java.lang.String aCity, java.lang.String aCountry)` Constructor for `EPPContactAddress` all of the required attributes as parameters.
    `EPPContactAddress(java.util.Vector someStreets, java.lang.String aCity, java.lang.String aStateProvince, java.lang.String aPostalCode, java.lang.String aCountry)` Constructor for `EPPContactAddress` all of the required attributes as parameters.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `clone()` Clone `EPPContactAddress`.
    `void` | `decode(org.w3c.dom.Element aElement)` Decode the `EPPContactAddress` attributes from the aElement DOM Element tree.
    `org.w3c.dom.Element` | `encode(org.w3c.dom.Document aDocument)` Encode a DOM Element tree from the attributes of the `EPPContactAddress` instance.
    `boolean` | `equals(java.lang.Object aObject)` implements a deep `EPPContactAddress` compare.
    `java.lang.String` | `getCity()` Gets the contact city.
    `java.lang.String` | `getCountry()` Gets the contact country.
    `java.lang.String` | `getNamespace()` Returns the XML namespace associated with the `EPPCodecComponent`.
    `java.lang.String` | `getPostalCode()` Gets the contact postal code
    `java.lang.String` | `getStateProvince()` Gets the contact state/province.
    `java.util.Vector` | `getStreets()` Gets the contact street(s).
    `boolean` | `hasCity()` Returns `true` if the address has city.
    `boolean` | `hasCountry()` Returns `true` if the address has country.
    `boolean` | `hasPostalCode()` Returns `true` if the address has postal code.
    `boolean` | `hasStateProvince()` Returns `true` if the address has state.
    `boolean` | `hasStreets()` Returns `true` if the address has at least one street.
    `void` | `setCity(java.lang.String aCity)` Sets the contact city.
    `void` | `setCountry(java.lang.String aCountry)` Sets the contact country.
    `void` | `setPostalCode(java.lang.String aPostalCode)` Sets the contact postal code
    `void` | `setStateProvince(java.lang.String aStateProvince)` Sets the contact state/province.
    `void` | `setStreet(java.lang.String aStreet)` Sets the contact street with only one `String` parameter.
    `void` | `setStreets(java.lang.String aStreet1, java.lang.String aStreet2)` Sets the contact street with two sub-street `String`'s.
    `void` | `setStreets(java.lang.String aStreet1, java.lang.String aStreet2, java.lang.String aStreet3)` Sets the contact street with three sub-street `String`'s.
    `void` | `setStreets(java.util.Vector someStreets)` Sets the contact street attribute with a `Vector` of `String`'s.
    `java.lang.String` | `toString()` Implementation of `toString`, which will result in an indented XML `String` representation of the concrete `EPPCodecComponent`.

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### EPPContactAddress

          public EPPContactAddress()

      Default constructor for `EPPContactAddress`. All the the attributes default to `null`. Must call required setter methods before invoking `encode`, which include:
      - city - `setCity`
      - country - `setCountry`

    - #### EPPContactAddress

          public EPPContactAddress(java.lang.String aCity,
                                   java.lang.String aCountry)

      Constructor for `EPPContactAddress` all of the required attributes as parameters.
      Parameters:
        `aCity` - contact street
        `aCountry` - contract country

    - #### EPPContactAddress

          public EPPContactAddress(java.util.Vector someStreets,
                                   java.lang.String aCity,
                                   java.lang.String aStateProvince,
                                   java.lang.String aPostalCode,
                                   java.lang.String aCountry)

      Constructor for `EPPContactAddress` all of the required attributes as parameters.
      Parameters:
        `someStreets` - `Vector` of street (up to maximum three) `String`'s
        `aCity` - contact street
        `aStateProvince` - contact state/province
        `aPostalCode` - contact postal code
        `aCountry` - contract country

  - ### Method Detail

    - #### getStreets

          public java.util.Vector getStreets()

      Gets the contact street(s).
      Returns:
        street(s) as a `Vector` of street (up to maximum three) `String` if defined; `null` otherwise.

    - #### hasStreets

          public boolean hasStreets()

      Returns `true` if the address has at least one street.
      Returns:
        `true` if the address at least one street `false` otherwise

    - #### setStreet

          public void setStreet(java.lang.String aStreet)

      Sets the contact street with only one `String` parameter. Only a one element `Vector` will be returned on a call to `getStreets` when originally set with this method.
      Parameters:
        `aStreet` - contact street.

    - #### setStreets

          public void setStreets(java.util.Vector someStreets)

      Sets the contact street attribute with a `Vector` of `String`'s.
      Parameters:
        `someStreets` - `Vector` of one or two street `String`'s.

    - #### setStreets

          public void setStreets(java.lang.String aStreet1,
                                 java.lang.String aStreet2)

      Sets the contact street with two sub-street `String`'s.
      Parameters:
        `aStreet1` - First part/line of contact street
        `aStreet2` - Second part/line of contact street

    - #### setStreets

          public void setStreets(java.lang.String aStreet1,
                                 java.lang.String aStreet2,
                                 java.lang.String aStreet3)

      Sets the contact street with three sub-street `String`'s.
      Parameters:
        `aStreet1` - First part/line of contact street
        `aStreet2` - Second part/line of contact street
        `aStreet3` - Third part/line of contact street

    - #### getCity

          public java.lang.String getCity()

      Gets the contact city.
      Returns:
        city. `String` if defined; `null` otherwise.

    - #### hasCity

          public boolean hasCity()

      Returns `true` if the address has city.
      Returns:
        `true` if the address has city `false` otherwise

    - #### setCity

          public void setCity(java.lang.String aCity)

      Sets the contact city.
      Parameters:
        `aCity` - contact city

    - #### getStateProvince

          public java.lang.String getStateProvince()

      Gets the contact state/province.
      Returns:
        state/province. `String` if defined; `null` otherwise.

    - #### hasStateProvince

          public boolean hasStateProvince()

      Returns `true` if the address has state.
      Returns:
        `true` if the address has state `false` otherwise

    - #### setStateProvince

          public void setStateProvince(java.lang.String aStateProvince)

      Sets the contact state/province.
      Parameters:
        `aStateProvince` - contact state/province

    - #### getPostalCode

          public java.lang.String getPostalCode()

      Gets the contact postal code
      Returns:
        postal code `String` if defined; `null` otherwise.

    - #### hasPostalCode

          public boolean hasPostalCode()

      Returns `true` if the address has postal code.
      Returns:
        `true` if the address has postal code `false` otherwise

    - #### setPostalCode

          public void setPostalCode(java.lang.String aPostalCode)

      Sets the contact postal code
      Parameters:
        `aPostalCode` - contact postal code

    - #### getCountry

          public java.lang.String getCountry()

      Gets the contact country.
      Returns:
        contact country `String` if defined; `null` otherwise.

    - #### hasCountry

          public boolean hasCountry()

      Returns `true` if the address has country.
      Returns:
        `true` if the address has country `false` otherwise

    - #### setCountry

          public void setCountry(java.lang.String aCountry)

      Sets the contact country.
      Parameters:
        `aCountry` - contact country

    - #### encode

          public org.w3c.dom.Element encode(org.w3c.dom.Document aDocument)
                                     throws EPPEncodeException

      Encode a DOM Element tree from the attributes of the `EPPContactAddress` instance.
      Specified by:
        `encode` in interface `EPPCodecComponent`
      Parameters:
        `aDocument` - DOM Document that is being built. Used as an Element factory.
      Returns:
        Root DOM Element representing the `EPPContactAddress` instance.
      Throws:
        `EPPEncodeException` - Unable to encode `EPPContactAddress` instance.

    - #### decode

          public void decode(org.w3c.dom.Element aElement)
                      throws EPPDecodeException

      Decode the `EPPContactAddress` attributes from the aElement DOM Element tree.
      Specified by:
        `decode` in interface `EPPCodecComponent`
      Parameters:
        `aElement` - Root DOM Element to decode `EPPContactAddress` from.
      Throws:
        `EPPDecodeException` - Unable to decode aElement.

    - #### equals

          public boolean equals(java.lang.Object aObject)

      implements a deep `EPPContactAddress` compare.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `aObject` - `EPPContactAddress` instance to compare with
      Returns:
        boolean

    - #### clone

          public java.lang.Object clone()
                                 throws java.lang.CloneNotSupportedException

      Clone `EPPContactAddress`.
      Specified by:
        `clone` in interface `EPPCodecComponent`
      Overrides:
        `clone` in class `java.lang.Object`
      Returns:
        clone of `EPPContactAddress`
      Throws:
        `java.lang.CloneNotSupportedException` - standard Object.clone exception

    - #### toString

          public java.lang.String toString()

      Implementation of `toString`, which will result in an indented XML `String` representation of the concrete `EPPCodecComponent`.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        Indented XML `String` if successful; `ERROR` otherwise.

    - #### getNamespace

          public java.lang.String getNamespace()

      Returns the XML namespace associated with the `EPPCodecComponent`.
      Specified by:
        `getNamespace` in interface `EPPCodecComponent`
      Returns:
        XML namespace for the `EPPCodecComponent`.