com.verisign.epp.codec.registry.v02

## Class EPPRegistryDomainPeriod

- java.lang.Object
- - com.verisign.epp.codec.registry.v02.EPPRegistryDomainPeriod

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

      public class EPPRegistryDomainPeriod
      extends java.lang.Object
      implements EPPCodecComponent

  Defines the supported registration periods and default periods by command type. The required "command" attribute defines the command type with sample values of "create", "renew", and "transfer". The <registry:period> element contains ONE of the following elements:
  - <registry:length> - The default, minimum, and maximum period length for the command type. Use `getLength()` and `setLength(EPPRegistryMinMaxPeriod)` to get and set this element.
  - <registry:serverDecided> - The registration period is decided by the server based on the relationship to a related object that MUST have the same expiration date. Use `getServerDecided()` and `setServerDecided(Boolean)` to get and set this element.
  See Also:
    `EPPRegistryDomain`, `EPPRegistryMinMaxPeriod`, Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `ATTR_COMMAND` XML attribute name for the `command` attribute.
    `static java.lang.String` | `ELM_LOCALNAME` XML local name for `EPPRegistryDomainPeriod`.
    `static java.lang.String` | `ELM_NAME` XML root tag for `EPPRegistryDomainPeriod`.
    `static java.lang.String` | `ELM_SERVER_DECIDED` XML Element Name of `serverDecided` attribute.
    `static int` | `MAX_PERIOD` Maximum period in years as defined in RFC5731
    `static int` | `MIN_PERIOD` Maximum period in years as defined in RFC5731

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EPPRegistryDomainPeriod()` Default constructor.
    `EPPRegistryDomainPeriod(java.lang.String aCommand, java.lang.Boolean aServerDecided)` Construct an instance of `EPPRegistryDomainPeriod` with the following inputs.
    `EPPRegistryDomainPeriod(java.lang.String aCommand, java.lang.Integer aMin, EPPRegistryPeriodType.Unit aMinUnit, java.lang.Integer aMax, EPPRegistryPeriodType.Unit aMaxUnit, java.lang.Integer aDefaultLength, EPPRegistryPeriodType.Unit aDefaultLengthUnit)` Construct an instance of `EPPRegistryDomainPeriod` with the following inputs.
    `EPPRegistryDomainPeriod(java.lang.String aCommand, int aMin, EPPRegistryPeriodType.Unit aMinUnit, int aMax, EPPRegistryPeriodType.Unit aMaxUnit, int aDefaultLength, EPPRegistryPeriodType.Unit aDefaultLengthUnit)` Construct an instance of `EPPRegistryDomainPeriod` with the following inputs.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `clone()` Clone `EPPRegistryDomainPeriod`.
    `void` | `decode(org.w3c.dom.Element aElement)` Decode the `EPPRegistryDomainPeriod` 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 `EPPRegistryDomainPeriod` instance.
    `boolean` | `equals(java.lang.Object aObject)` implements a deep `EPPRegistryDomainPeriod` compare.
    `java.lang.String` | `getCommand()` Gets the command type.
    `EPPRegistryMinMaxPeriod` | `getLength()` Gets the length for an EPP domain transform command.
    `java.lang.String` | `getNamespace()` Returns the XML namespace associated with the `EPPCodecComponent`.
    `java.lang.Boolean` | `getServerDecided()` Gets whether to have server decided expiration date.
    `void` | `setCommand(java.lang.String command)` Sets the command type.
    `void` | `setLength(EPPRegistryMinMaxPeriod length)` Sets the length for an EPP domain transform command.
    `void` | `setServerDecided(java.lang.Boolean serverDecided)` Sets whether to have server decided expiration date.
    `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

    - #### ELM_LOCALNAME

          public static final java.lang.String ELM_LOCALNAME

      XML local name for `EPPRegistryDomainPeriod`.
      See Also:
        Constant Field Values

    - #### ELM_NAME

          public static final java.lang.String ELM_NAME

      XML root tag for `EPPRegistryDomainPeriod`.
      See Also:
        Constant Field Values

    - #### ELM_SERVER_DECIDED

          public static final java.lang.String ELM_SERVER_DECIDED

      XML Element Name of `serverDecided` attribute.
      See Also:
        Constant Field Values

    - #### ATTR_COMMAND

          public static final java.lang.String ATTR_COMMAND

      XML attribute name for the `command` attribute.
      See Also:
        Constant Field Values

    - #### MAX_PERIOD

          public static final int MAX_PERIOD

      Maximum period in years as defined in RFC5731
      See Also:
        Constant Field Values

    - #### MIN_PERIOD

          public static final int MIN_PERIOD

      Maximum period in years as defined in RFC5731
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### EPPRegistryDomainPeriod

          public EPPRegistryDomainPeriod()

      Default constructor. Attributes are set default values:
      - `command` - `null`
      - `length` - `null`
      - `serverDecided` - `Boolean.FALSE`

    - #### EPPRegistryDomainPeriod

          public EPPRegistryDomainPeriod(java.lang.String aCommand,
                                         java.lang.Integer aMin,
                                         EPPRegistryPeriodType.Unit aMinUnit,
                                         java.lang.Integer aMax,
                                         EPPRegistryPeriodType.Unit aMaxUnit,
                                         java.lang.Integer aDefaultLength,
                                         EPPRegistryPeriodType.Unit aDefaultLengthUnit)

      Construct an instance of `EPPRegistryDomainPeriod` with the following inputs. `serverDecided` is set to `Boolean.FALSE`:
      Parameters:
        `aCommand` - command type
        `aMin` - minimum length number
        `aMinUnit` - minimum length unit
        `aMax` - maximum length number
        `aMaxUnit` - maximum length unit
        `aDefaultLength` - default length number
        `aDefaultLengthUnit` - length unit

    - #### EPPRegistryDomainPeriod

          public EPPRegistryDomainPeriod(java.lang.String aCommand,
                                         int aMin,
                                         EPPRegistryPeriodType.Unit aMinUnit,
                                         int aMax,
                                         EPPRegistryPeriodType.Unit aMaxUnit,
                                         int aDefaultLength,
                                         EPPRegistryPeriodType.Unit aDefaultLengthUnit)

      Construct an instance of `EPPRegistryDomainPeriod` with the following inputs. `serverDecided` is set to `Boolean.FALSE`:
      Parameters:
        `aCommand` - command type
        `aMin` - minimum length number
        `aMinUnit` - minimum length unit
        `aMax` - maximum length number
        `aMaxUnit` - maximum length unit
        `aDefaultLength` - default length number
        `aDefaultLengthUnit` - length unit

    - #### EPPRegistryDomainPeriod

          public EPPRegistryDomainPeriod(java.lang.String aCommand,
                                         java.lang.Boolean aServerDecided)

      Construct an instance of `EPPRegistryDomainPeriod` with the following inputs. `length` is set to `null`:
      Parameters:
        `aCommand` - command type
        `aServerDecided` - whether no not to have server decided expiration date

  - ### Method Detail

    - #### encode

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

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

    - #### decode

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

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

    - #### clone

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

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

    - #### equals

          public boolean equals(java.lang.Object aObject)

      implements a deep `EPPRegistryDomainPeriod` compare.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `aObject` - `EPPRegistryDomainPeriod` instance to compare with
      Returns:
        `true` if this object is the same as the aObject argument; `false` otherwise

    - #### 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.

    - #### getLength

          public EPPRegistryMinMaxPeriod getLength()

      Gets the length for an EPP domain transform command.
      Returns:
        instance of `EPPRegistryMinMaxPeriod` that defines min/max/default period for a given command

    - #### setLength

          public void setLength(EPPRegistryMinMaxPeriod length)

      Sets the length for an EPP domain transform command.
      Parameters:
        `length` - instance of `EPPRegistryMinMaxPeriod` that defines min/max/default period for a given command

    - #### getServerDecided

          public java.lang.Boolean getServerDecided()

      Gets whether to have server decided expiration date.
      Returns:
        `true` - the registration period is decided by the server based on the relationship to a related object that MUST have the same expiration date. `false` - the registration period is specified in the `length` attribute.

    - #### setServerDecided

          public void setServerDecided(java.lang.Boolean serverDecided)

      Sets whether to have server decided expiration date.
      Parameters:
        `serverDecided` - `true` - the registration period is decided by the server based on the relationship to a related object that MUST have the same expiration date. `false` - the registration period is specified in the `length` attribute.

    - #### getCommand

          public java.lang.String getCommand()

      Gets the command type.
      Returns:
        command type in `String`. Valid values are "create", "renew" and "transfer".

    - #### setCommand

          public void setCommand(java.lang.String command)

      Sets the command type.
      Parameters:
        `command` - command type in `String`. Valid values are "create", "renew" and "transfer".

    - #### 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`.