Package com.highdeal.pnr.hci
Class DurationModel
java.lang.Object
com.highdeal.pnr.hci.DurationModel
- All Implemented Interfaces:
IXMLMarshallable,XMLMarshallable
This class represents the model of the duration.
A duration is composed by a quantity and a unit of time.
The quantity can be zero or a positive or negative integer.
By default the quantity is zero and the time unit is null.
XML API for HCI
The XML APIs specify the following XSD fragment:
XSD Fragment
<xs:simpleType name="TimeUnit">
<xs:restriction base="xs:string">
<xs:enumeration value="second"/>
<xs:enumeration value="minute"/>
<xs:enumeration value="hour"/>
<xs:enumeration value="day"/>
<xs:enumeration value="month"/>
<xs:enumeration value="year"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="Duration">
<xs:attribute name="quantity" type="xs:integer" use="required"/>
<xs:attribute name="timeUnit" type="TimeUnit" use="required"/>
</xs:complexType>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCharacterData(String cData) Adds character data to the content element.voidaddChild(String tagName, XMLMarshallable child) Adds a child to the object, thechildrepresenting the marshallable object which must be added to the element.static com.highdeal.util.UnitOfTime[]Gets the list of authorized unit of time.intReturns the quantity ofunit of timeof this duration.com.highdeal.util.UnitOfTimeReturns theunit of timeof this duration.booleanCheck whether this duration is well formed or not.voidmarshal(XMLOutputter output) Deprecated.voidmarshalAttributes(XMLOutputter output) Gives an XML representation of the attributes of an object.voidmarshalChildren(XMLOutputter output) Gives an XML representation of the child objects of an object.voidsetAttributes(XMLAttributes atts) Sets the attributes of the XML representation of the element being processed.voidsetQuantity(int quantity) Sets the quantity of time oftime unitof this duration.voidsetUnitOfTime(com.highdeal.util.UnitOfTime timeUnit) Sets the unit of time of this duration.
-
Constructor Details
-
DurationModel
public DurationModel()
-
-
Method Details
-
getQuantity
public int getQuantity()Returns the quantity ofunit of timeof this duration.- Returns:
- zero, a positive or negative integer representing the number of unit of time of this duration.
-
setQuantity
public void setQuantity(int quantity) Sets the quantity of time oftime unitof this duration.- Parameters:
quantity- zero, a positive or negative integer whether the duration means after or before respectively.
-
getUnitOfTime
public com.highdeal.util.UnitOfTime getUnitOfTime()Returns theunit of timeof this duration.- Returns:
- an item of the enumeration
UnitOfTimeif set, null otherwise. - See Also:
-
setUnitOfTime
public void setUnitOfTime(com.highdeal.util.UnitOfTime timeUnit) Sets the unit of time of this duration.- Parameters:
timeUnit- an item of the enumerationUnitOfTime, null is accepted but this duration will not be well formed.- See Also:
-
isWellFormed
public boolean isWellFormed()Check whether this duration is well formed or not.- Returns:
- true if this duration has a
UnitOfTime, false otherwise.
-
getAuthorizedUnitOfTime
public static com.highdeal.util.UnitOfTime[] getAuthorizedUnitOfTime()Gets the list of authorized unit of time.- Returns:
- the list of authorized unit of time.
-
setAttributes
Description copied from interface:XMLMarshallableSets the attributes of the XML representation of the element being processed.- Specified by:
setAttributesin interfaceXMLMarshallable- Parameters:
atts- TheXML attributesof the current element
-
addChild
Description copied from interface:XMLMarshallableAdds a child to the object, thechildrepresenting the marshallable object which must be added to the element.- Specified by:
addChildin interfaceXMLMarshallable- Parameters:
tagName- The name of tag for the childchild- The child to be added
-
marshalAttributes
Description copied from interface:IXMLMarshallableGives an XML representation of the attributes of an object.- Specified by:
marshalAttributesin interfaceIXMLMarshallable- Parameters:
output- TheXML outputto marshal the object attributes into
-
marshalChildren
Description copied from interface:IXMLMarshallableGives an XML representation of the child objects of an object.- Specified by:
marshalChildrenin interfaceIXMLMarshallable- Parameters:
output- TheXML outputto marshal the child objects into
-
addCharacterData
Description copied from interface:XMLMarshallableAdds character data to the content element.- Specified by:
addCharacterDatain interfaceXMLMarshallable- Parameters:
cData- The character data to be added
-
marshal
Deprecated.Description copied from interface:XMLMarshallableGives an XML representation of this object, including its children.- Specified by:
marshalin interfaceIXMLMarshallable- Specified by:
marshalin interfaceXMLMarshallable- Parameters:
output- TheXML outputto marshal the object into
-