Class EPPContactAddress

java.lang.Object
com.verisign.epp.codec.contact.EPPContactAddress
All Implemented Interfaces:
EPPCodecComponent, Serializable, Cloneable

public class EPPContactAddress extends 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:
  • Constructor Details

    • 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(String aCity, String aCountry)
      Constructor for EPPContactAddress all of the required attributes as parameters.
      Parameters:
      aCity - contact street
      aCountry - contract country
    • EPPContactAddress

      public EPPContactAddress(Vector someStreets, String aCity, String aStateProvince, String aPostalCode, 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 Details

    • getStreets

      public 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(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(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(String aStreet1, 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(String aStreet1, String aStreet2, 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 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(String aCity)
      Sets the contact city.
      Parameters:
      aCity - contact city
    • getStateProvince

      public 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(String aStateProvince)
      Sets the contact state/province.
      Parameters:
      aStateProvince - contact state/province
    • getPostalCode

      public 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(String aPostalCode)
      Sets the contact postal code
      Parameters:
      aPostalCode - contact postal code
    • getCountry

      public 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(String aCountry)
      Sets the contact country.
      Parameters:
      aCountry - contact country
    • encode

      public Element encode(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(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(Object aObject)
      implements a deep EPPContactAddress compare.
      Overrides:
      equals in class Object
      Parameters:
      aObject - EPPContactAddress instance to compare with
      Returns:
      boolean
    • clone

      public Object clone() throws CloneNotSupportedException
      Specified by:
      clone in interface EPPCodecComponent
      Overrides:
      clone in class Object
      Returns:
      clone of EPPContactAddress
      Throws:
      CloneNotSupportedException - standard Object.clone exception
    • toString

      public String toString()
      Implementation of toString, which will result in an indented XML String representation of the concrete EPPCodecComponent.
      Overrides:
      toString in class Object
      Returns:
      Indented XML String if successful; ERROR otherwise.
    • getNamespace

      public String getNamespace()
      Returns the XML namespace associated with the EPPCodecComponent.
      Specified by:
      getNamespace in interface EPPCodecComponent
      Returns:
      XML namespace for the EPPCodecComponent.