Class EPPFeePeriod

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

    public class EPPFeePeriod
    extends java.lang.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:
    Serialized Form
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Clone EPPFeePeriod instance.
      void decode​(org.w3c.dom.Element aElement)
      Decode the EPPFeePeriod 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 EPPFeePeriod instance.
      boolean equals​(java.lang.Object aObject)
      Implements a deep EPPFeePeriod compare.
      java.lang.String getNamespace()
      Returns the XML namespace associated with the EPPCodecComponent.
      int getPeriod()
      Get the period.
      java.lang.String getPUnit()
      Get the period unit.
      boolean isPeriodUnspec()
      Test whether the period has been specified.
      void setPeriod​(int aPeriod)
      Set the period.
      void setPUnit​(java.lang.String aPUnit)
      Sets the period unit.
      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

      • PERIOD_UNIT_MONTH

        public static final java.lang.String PERIOD_UNIT_MONTH
        Period in Unit Month
        See Also:
        Constant Field Values
      • PERIOD_UNIT_YEAR

        public static final java.lang.String PERIOD_UNIT_YEAR
        Period in Unit Year
        See Also:
        Constant Field Values
      • UNSPEC_PERIOD

        public static final int UNSPEC_PERIOD
        Unspecified Period
        See Also:
        Constant Field Values
      • MAX_PERIOD

        public static final int MAX_PERIOD
        Maximum number of periods.
        See Also:
        Constant Field Values
      • MIN_PERIOD

        public static final int MIN_PERIOD
        Minimum number of periods.
        See Also:
        Constant Field Values
      • ELM_LOCALNAME

        public static final java.lang.String ELM_LOCALNAME
        XML local name for EPPFeePeriod.
        See Also:
        Constant Field Values
    • Constructor Detail

      • 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​(java.lang.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 Detail

      • clone

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

        public void decode​(org.w3c.dom.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 org.w3c.dom.Element encode​(org.w3c.dom.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​(java.lang.Object aObject)
        Implements a deep EPPFeePeriod compare.
        Overrides:
        equals in class java.lang.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 java.lang.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​(java.lang.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 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.