Class EPPFeePeriod

java.lang.Object
com.verisign.epp.codec.fee.v1_0.EPPFeePeriod
All Implemented Interfaces:
EPPCodecComponent, Serializable, Cloneable

public class EPPFeePeriod extends Object implements EPPCodecComponent
Represents a fee period. Validity periods are measured in years or months with the appropriate units specified using the unit attribute. Valid values for the unit attribute are y for years and m for months.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    XML local name for EPPFeePeriod.
    static final int
    Maximum number of periods.
    static final int
    Minimum number of periods.
    static final String
    Period in Unit Month
    static final String
    Period in Unit Year
    static final int
    Unspecified Period
  • Constructor Summary

    Constructors
    Constructor
    Description
    EPPFeePeriod default constructor.
    EPPFeePeriod(int aPeriod)
    EPPFeePeriod constructor that takes the period value with a default unit of PERIOD_UNIT_YEAR.
    EPPFeePeriod(String aPUnit, int aPeriod)
    EPPFeePeriod constructor that takes the period and period unit as an arguments.
  • Method Summary

    Modifier and Type
    Method
    Description
    Clone EPPFeePeriod instance.
    void
    decode(Element aElement)
    Decode the EPPFeePeriod attributes from the aElement DOM Element tree.
    encode(Document aDocument)
    Encode a DOM Element tree from the attributes of the EPPFeePeriod instance.
    boolean
    equals(Object aObject)
    Implements a deep EPPFeePeriod compare.
    Returns the XML namespace associated with the EPPCodecComponent.
    int
    Get the period.
    Get the period unit.
    boolean
    Test whether the period has been specified.
    void
    setPeriod(int aPeriod)
    Set the period.
    void
    setPUnit(String aPUnit)
    Sets the period unit.
    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 Details

  • Constructor Details

    • EPPFeePeriod

      public EPPFeePeriod()
      EPPFeePeriod default constructor. The period is initialized to UNSPEC_PERIOD. The period must be set before invoking encode.
    • EPPFeePeriod

      public EPPFeePeriod(int aPeriod)
      EPPFeePeriod constructor that takes the period value with a default unit of PERIOD_UNIT_YEAR.
      Parameters:
      aPeriod - Period value
    • EPPFeePeriod

      public EPPFeePeriod(String aPUnit, int aPeriod)
      EPPFeePeriod constructor that takes the period and period unit as an arguments.
      Parameters:
      aPUnit - Period value
      aPeriod - The period unit that must be either PERIOD_UNIT_YEAR or PERIOD_UNIT_MONTH.
  • Method Details

    • clone

      public Object clone() throws CloneNotSupportedException
      Clone EPPFeePeriod instance.
      Specified by:
      clone in interface EPPCodecComponent
      Overrides:
      clone in class Object
      Returns:
      clone of EPPFeePeriod
      Throws:
      CloneNotSupportedException - standard Object.clone exception
    • decode

      public void decode(Element aElement) throws EPPDecodeException
      Decode the EPPFeePeriod attributes from the aElement DOM Element tree.
      Specified by:
      decode in interface EPPCodecComponent
      Parameters:
      aElement - - Root DOM Element to decode EPPFeePeriod from.
      Throws:
      EPPDecodeException - Unable to decode aElement
    • encode

      public Element encode(Document aDocument) throws EPPEncodeException
      Encode a DOM Element tree from the attributes of the EPPFeePeriod 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 EPPFeePeriod instance.
      Throws:
      EPPEncodeException - - Unable to encode EPPFeePeriod instance.
    • equals

      public boolean equals(Object aObject)
      Implements a deep EPPFeePeriod compare.
      Overrides:
      equals in class Object
      Parameters:
      aObject - EPPFeePeriod instance to compare with
      Returns:
      true if equals; false otherwise.
    • getPeriod

      public int getPeriod()
      Get the period.
      Returns:
      The period if defined; UNSPEC_PERIOD otherwise.
    • getPUnit

      public String getPUnit()
      Get the period unit.
      Returns:
      Either PERIOD_UNIT_YEAR for year or PERIOD_UNIT_MONTH for month.
    • isPeriodUnspec

      public boolean isPeriodUnspec()
      Test whether the period has been specified.
      Returns:
      true if unspecified; false otherwise.
    • setPeriod

      public void setPeriod(int aPeriod) throws EPPCodecException
      Set the period.
      Parameters:
      aPeriod - Period value. Can be UNSPEC_PERIOD to clear the period; otherwise the period must be between MIN_PERIOD and MAX_PERIOD.
      Throws:
      EPPCodecException - Error with period value.
    • setPUnit

      public void setPUnit(String aPUnit)
      Sets the period unit.
      Parameters:
      aPUnit - Must be either PERIOD_UNIT_YEAR or PERIOD_UNIT_MONTH. If not, no change will be made.
    • toString

      public String toString()
      Implementation of Object.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.