Package com.verisign.epp.codec.fee.v1_0
Class EPPFeePeriod
- java.lang.Object
-
- com.verisign.epp.codec.fee.v1_0.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 theunitattribute. Valid values for theunitattribute areyfor years andmfor months.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringELM_LOCALNAMEXML local name forEPPFeePeriod.static intMAX_PERIODMaximum number of periods.static intMIN_PERIODMinimum number of periods.static java.lang.StringPERIOD_UNIT_MONTHPeriod in Unit Monthstatic java.lang.StringPERIOD_UNIT_YEARPeriod in Unit Yearstatic intUNSPEC_PERIODUnspecified Period
-
Constructor Summary
Constructors Constructor Description EPPFeePeriod()EPPFeePerioddefault constructor.EPPFeePeriod(int aPeriod)EPPFeePeriodconstructor that takes the period value with a default unit ofPERIOD_UNIT_YEAR.EPPFeePeriod(java.lang.String aPUnit, int aPeriod)EPPFeePeriodconstructor 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.Objectclone()CloneEPPFeePeriodinstance.voiddecode(org.w3c.dom.Element aElement)Decode the EPPFeePeriod attributes from the aElement DOM Element tree.org.w3c.dom.Elementencode(org.w3c.dom.Document aDocument)Encode a DOM Element tree from the attributes of the EPPFeePeriod instance.booleanequals(java.lang.Object aObject)Implements a deepEPPFeePeriodcompare.java.lang.StringgetNamespace()Returns the XML namespace associated with theEPPCodecComponent.intgetPeriod()Get the period.java.lang.StringgetPUnit()Get the period unit.booleanisPeriodUnspec()Test whether the period has been specified.voidsetPeriod(int aPeriod)Set the period.voidsetPUnit(java.lang.String aPUnit)Sets the period unit.java.lang.StringtoString()Implementation ofObject.toString, which will result in an indented XMLStringrepresentation of the concreteEPPCodecComponent.
-
-
-
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 forEPPFeePeriod.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EPPFeePeriod
public EPPFeePeriod()
EPPFeePerioddefault constructor. The period is initialized toUNSPEC_PERIOD. The period must be set before invokingencode.
-
EPPFeePeriod
public EPPFeePeriod(int aPeriod)
EPPFeePeriodconstructor that takes the period value with a default unit ofPERIOD_UNIT_YEAR.- Parameters:
aPeriod- Period value
-
EPPFeePeriod
public EPPFeePeriod(java.lang.String aPUnit, int aPeriod)EPPFeePeriodconstructor that takes the period and period unit as an arguments.- Parameters:
aPUnit- Period valueaPeriod- The period unit that must be eitherPERIOD_UNIT_YEARorPERIOD_UNIT_MONTH.
-
-
Method Detail
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedExceptionCloneEPPFeePeriodinstance.- Specified by:
clonein interfaceEPPCodecComponent- Overrides:
clonein classjava.lang.Object- Returns:
- clone of
EPPFeePeriod - Throws:
java.lang.CloneNotSupportedException- standard Object.clone exception
-
decode
public void decode(org.w3c.dom.Element aElement) throws EPPDecodeExceptionDecode the EPPFeePeriod attributes from the aElement DOM Element tree.- Specified by:
decodein interfaceEPPCodecComponent- 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 EPPEncodeExceptionEncode a DOM Element tree from the attributes of the EPPFeePeriod instance.- Specified by:
encodein interfaceEPPCodecComponent- 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 deepEPPFeePeriodcompare.- Overrides:
equalsin classjava.lang.Object- Parameters:
aObject-EPPFeePeriodinstance to compare with- Returns:
trueif equals;falseotherwise.
-
getPeriod
public int getPeriod()
Get the period.- Returns:
- The period if defined;
UNSPEC_PERIODotherwise.
-
getPUnit
public java.lang.String getPUnit()
Get the period unit.- Returns:
- Either
PERIOD_UNIT_YEARfor year orPERIOD_UNIT_MONTHfor month.
-
isPeriodUnspec
public boolean isPeriodUnspec()
Test whether the period has been specified.- Returns:
trueif unspecified;falseotherwise.
-
setPeriod
public void setPeriod(int aPeriod) throws EPPCodecExceptionSet the period.- Parameters:
aPeriod- Period value. Can beUNSPEC_PERIODto clear the period; otherwise the period must be betweenMIN_PERIODandMAX_PERIOD.- Throws:
EPPCodecException- Error with period value.
-
setPUnit
public void setPUnit(java.lang.String aPUnit)
Sets the period unit.- Parameters:
aPUnit- Must be eitherPERIOD_UNIT_YEARorPERIOD_UNIT_MONTH. If not, no change will be made.
-
toString
public java.lang.String toString()
Implementation ofObject.toString, which will result in an indented XMLStringrepresentation of the concreteEPPCodecComponent.- Overrides:
toStringin classjava.lang.Object- Returns:
- Indented XML
Stringif successful;ERRORotherwise.
-
getNamespace
public java.lang.String getNamespace()
Returns the XML namespace associated with theEPPCodecComponent.- Specified by:
getNamespacein interfaceEPPCodecComponent- Returns:
- XML namespace for the
EPPCodecComponent.
-
-