Package com.verisign.epp.codec.host

## Class EPPHostAddress

- java.lang.Object
- - com.verisign.epp.codec.host.EPPHostAddress

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

      public class EPPHostAddress
      extends java.lang.Object
      implements EPPCodecComponent

  Represents a host address specified in an `EPPHostCreateCmd` or in an `EPPHostAddRemove` object of an `EPPHostUpdateCmd`. An address consists of a name and a type, where type is either `EPPHostAddress.IPV4` or `EPPHostAddress.IPV6`. The default type is `EPPHostAddress.IPV4`.
  See Also:
    `EPPHostCreateCmd`, `EPPHostUpdateCmd`, `EPPHostAddRemove`, Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `ATTR_IPV6` | IPV6 IP address constant.
    `static java.lang.String` | `ELM_NAME` | XML Element Name of `EPPHostAddress` root element.
    `static short` | `IPV4` | IPV4 IP address constant.
    `static short` | `IPV6` | IPV6 IP address constant.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `EPPHostAddress()` | Default constructor for `EPPHostAddress`.
    `EPPHostAddress​(java.lang.String aName)` | Constructor for `EPPHostAddress` that the takes the string name of the IP address with the type set to `IPV4`.
    `EPPHostAddress​(java.lang.String aName, short aType)` | Constructor for `EPPHostAddress` that the takes the string name of the IP address along with the type of the IP address using either the constant `EPPHostAddress.IPV4` or `EPPHostAddress.IPV6`.
    `EPPHostAddress​(java.lang.String aRootNS, java.lang.String aRootName, java.lang.String aName)` | Constructor for `EPPHostAddress` that the takes the string name of an IPV4 IP address and the root tag to use.
    `EPPHostAddress​(java.lang.String aRootNS, java.lang.String aRootName, java.lang.String aName, short aType)` | Constructor for `EPPHostAddress` that the takes the string name of an IPV4 or IPV6 IP address and the root tag to use.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.Object` | `clone()` | Clone `EPPHostAddress`.
    `void` | `decode​(org.w3c.dom.Element aElement)` | Decode the `EPPHostAddress` 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 `EPPHostAddress` instance.
    `boolean` | `equals​(java.lang.Object aObject)` | implements a deep `EPPHostAddress` compare.
    `java.lang.String` | `getName()` | Gets the addresss name in the format specified by `getType`.
    `java.lang.String` | `getNamespace()` | Returns the XML namespace associated with the `EPPCodecComponent`.
    `java.lang.String` | `getRootName()` | Get root name such as domain.
    `java.lang.String` | `getRootNS()` | Gets the root element XML namespace URI.
    `short` | `getType()` | Gets the type of the address name, which should be either the `EPPHostAddress.IPV4` or the `EPPHostAddress.IPV6` constant.
    `void` | `setName​(java.lang.String aName)` | Sets the address name in the format specified by `setType`.
    `void` | `setName​(java.lang.String aName, short aType)` | Sets the address name and address type.
    `void` | `setRootName​(java.lang.String aRootNS, java.lang.String aRootName)` | Set root name such as domain.
    `void` | `setType​(short aType)` | Sets the type of the address name to either the `EPPHostAddress.IPV4` or the `EPPHostAddress.IPV6` constant.
    `java.lang.String` | `toString()` | Implementation of `Object.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`

- - ### Field Detail

    - #### IPV4

          public static final short IPV4

      IPV4 IP address constant. This is the default type.
      See Also:
        Constant Field Values

    - #### IPV6

          public static final short IPV6

      IPV6 IP address constant.
      See Also:
        Constant Field Values

    - #### ELM_NAME

          public static final java.lang.String ELM_NAME

      XML Element Name of `EPPHostAddress` root element.
      See Also:
        Constant Field Values

    - #### ATTR_IPV6

          public static final java.lang.String ATTR_IPV6

      IPV6 IP address constant.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### EPPHostAddress

          public EPPHostAddress()

      Default constructor for `EPPHostAddress`. The name attribute defaults to `null` and must be set using `setName` before invoking `encode`. The type defaults to IPV4.

    - #### EPPHostAddress

          public EPPHostAddress​(java.lang.String aName)

      Constructor for `EPPHostAddress` that the takes the string name of the IP address with the type set to `IPV4`.
      Parameters:
        `aName` - IP address name.

    - #### EPPHostAddress

          public EPPHostAddress​(java.lang.String aName,
                                short aType)

      Constructor for `EPPHostAddress` that the takes the string name of the IP address along with the type of the IP address using either the constant `EPPHostAddress.IPV4` or `EPPHostAddress.IPV6`.
      Parameters:
        `aName` - IP address name.
        `aType` - `EPPHostAddress.IPV4` or `EPPHostAddress.IPV6` constant.

    - #### EPPHostAddress

          public EPPHostAddress​(java.lang.String aRootNS,
                                java.lang.String aRootName,
                                java.lang.String aName)

      Constructor for `EPPHostAddress` that the takes the string name of an IPV4 IP address and the root tag to use. This constructor is useful for other mappings like domain.
      Parameters:
        `aRootNS` - Root element namespace URI
        `aRootName` - Root tag for the element
        `aName` - IP address name in IPV4 format.

    - #### EPPHostAddress

          public EPPHostAddress​(java.lang.String aRootNS,
                                java.lang.String aRootName,
                                java.lang.String aName,
                                short aType)

      Constructor for `EPPHostAddress` that the takes the string name of an IPV4 or IPV6 IP address and the root tag to use. This constructor is useful for other mappings like domain.
      Parameters:
        `aRootNS` - Root element namespace URI
        `aRootName` - Root tag for the element
        `aName` - IP address name in IPV4 format.
        `aType` - `EPPHostAddress.IPV4` or `EPPHostAddress.IPV6` constant.

  - ### Method Detail

    - #### getRootNS

          public java.lang.String getRootNS()

      Gets the root element XML namespace URI.
      Returns:
        root element XML namespace URI

    - #### getRootName

          public java.lang.String getRootName()

      Get root name such as domain.
      Returns:
        Root element tag to use

    - #### setRootName

          public void setRootName​(java.lang.String aRootNS,
                                  java.lang.String aRootName)

      Set root name such as domain.
      Parameters:
        `aRootNS` - Root element namespace URI
        `aRootName` - Root element tag to use

    - #### getName

          public java.lang.String getName()

      Gets the addresss name in the format specified by `getType`.
      Returns:
        Address name `String` instance if defined; `null` otherwise.

    - #### setName

          public void setName​(java.lang.String aName)

      Sets the address name in the format specified by `setType`.
      Parameters:
        `aName` - address name

    - #### setName

          public void setName​(java.lang.String aName,
                              short aType)

      Sets the address name and address type. `aType` should be either `EPPHostAddress.IPV4` or `EPPHostAddress.IPV6`, and the address name should conform to the format of the type.
      Parameters:
        `aName` - address name
        `aType` - address type ((`EPPHostAddress.IPV4` or `EPPHostAddress.IPV6`)

    - #### getType

          public short getType()

      Gets the type of the address name, which should be either the `EPPHostAddress.IPV4` or the `EPPHostAddress.IPV6` constant.
      Returns:
        Type of the address (`EPPHostAddress.IPV4` or `EPPHostAddress.IPV6`)

    - #### setType

          public void setType​(short aType)

      Sets the type of the address name to either the `EPPHostAddress.IPV4` or the `EPPHostAddress.IPV6` constant.
      Parameters:
        `aType` - `IPV4` or `IPV6`

    - #### encode

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

      Encode a DOM Element tree from the attributes of the `EPPHostAddress` 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 `EPPHostAddress` instance.
      Throws:
        `EPPEncodeException` - Unable to encode `EPPHostAddress` instance.

    - #### decode

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

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

    - #### equals

          public boolean equals​(java.lang.Object aObject)

      implements a deep `EPPHostAddress` compare.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `aObject` - `EPPHostAddress` instance to compare with
      Returns:
        `true` if `aObject` is equal; `false` otherwise.

    - #### clone

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

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

    - #### toString

          public java.lang.String toString()

      Implementation of `Object.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`.