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 theunit
attribute. Valid values for theunit
attribute arey
for years andm
for months.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ELM_LOCALNAME
XML local name forEPPFeePeriod
.static int
MAX_PERIOD
Maximum number of periods.static int
MIN_PERIOD
Minimum number of periods.static java.lang.String
PERIOD_UNIT_MONTH
Period in Unit Monthstatic java.lang.String
PERIOD_UNIT_YEAR
Period in Unit Yearstatic int
UNSPEC_PERIOD
Unspecified Period
-
Constructor Summary
Constructors Constructor Description EPPFeePeriod()
EPPFeePeriod
default constructor.EPPFeePeriod(int aPeriod)
EPPFeePeriod
constructor that takes the period value with a default unit ofPERIOD_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()
CloneEPPFeePeriod
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 deepEPPFeePeriod
compare.java.lang.String
getNamespace()
Returns the XML namespace associated with theEPPCodecComponent
.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 ofObject.toString
, which will result in an indented XMLString
representation 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()
EPPFeePeriod
default constructor. The period is initialized toUNSPEC_PERIOD
. The period must be set before invokingencode
.
-
EPPFeePeriod
public EPPFeePeriod(int aPeriod)
EPPFeePeriod
constructor 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)
EPPFeePeriod
constructor that takes the period and period unit as an arguments.- Parameters:
aPUnit
- Period valueaPeriod
- The period unit that must be eitherPERIOD_UNIT_YEAR
orPERIOD_UNIT_MONTH
.
-
-
Method Detail
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
CloneEPPFeePeriod
instance.- Specified by:
clone
in interfaceEPPCodecComponent
- Overrides:
clone
in 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 EPPDecodeException
Decode the EPPFeePeriod attributes from the aElement DOM Element tree.- Specified by:
decode
in 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 EPPEncodeException
Encode a DOM Element tree from the attributes of the EPPFeePeriod instance.- Specified by:
encode
in 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 deepEPPFeePeriod
compare.- Overrides:
equals
in classjava.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 orPERIOD_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 beUNSPEC_PERIOD
to clear the period; otherwise the period must be betweenMIN_PERIOD
andMAX_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_YEAR
orPERIOD_UNIT_MONTH
. If not, no change will be made.
-
toString
public java.lang.String toString()
Implementation ofObject.toString
, which will result in an indented XMLString
representation of the concreteEPPCodecComponent
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- Indented XML
String
if successful;ERROR
otherwise.
-
getNamespace
public java.lang.String getNamespace()
Returns the XML namespace associated with theEPPCodecComponent
.- Specified by:
getNamespace
in interfaceEPPCodecComponent
- Returns:
- XML namespace for the
EPPCodecComponent
.
-
-