public class DurationModel extends Object implements IXMLMarshallable
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.
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 and Description |
|---|
DurationModel() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCharacterData(String cData)
Adds character data to the content element.
|
void |
addChild(String tagName,
XMLMarshallable child)
Adds a child to the object, the
child representing
the marshallable object which must be added to the element. |
static com.highdeal.util.UnitOfTime[] |
getAuthorizedUnitOfTime()
Gets the list of authorized unit of time.
|
int |
getQuantity()
Returns the quantity of
unit of time of this duration. |
com.highdeal.util.UnitOfTime |
getUnitOfTime()
Returns the
unit of time of this duration. |
boolean |
isWellFormed()
Check whether this duration is well formed or not.
|
void |
marshal(XMLOutputter output)
Deprecated.
|
void |
marshalAttributes(XMLOutputter output)
Gives an XML representation of the attributes of an object.
|
void |
marshalChildren(XMLOutputter output)
Gives an XML representation of the child objects of an object.
|
void |
setAttributes(XMLAttributes atts)
Sets the attributes of the XML representation of the element being
processed.
|
void |
setQuantity(int quantity)
Sets the quantity of time of
time unit of this duration. |
void |
setUnitOfTime(com.highdeal.util.UnitOfTime timeUnit)
Sets the unit of time of this duration.
|
public int getQuantity()
unit of time of this duration.public void setQuantity(int quantity)
time unit of this duration.quantity - zero, a positive or negative integer whether the duration means after or before respectively.public com.highdeal.util.UnitOfTime getUnitOfTime()
unit of time of this duration.UnitOfTime if set, null otherwise.setUnitOfTime(UnitOfTime),
isWellFormed()public void setUnitOfTime(com.highdeal.util.UnitOfTime timeUnit)
timeUnit - an item of the enumeration UnitOfTime,
null is accepted but this duration will not be well formed.isWellFormed()public boolean isWellFormed()
UnitOfTime, false otherwise.public static com.highdeal.util.UnitOfTime[] getAuthorizedUnitOfTime()
public void setAttributes(XMLAttributes atts)
XMLMarshallablesetAttributes in interface XMLMarshallableatts - The XML attributes of the current elementpublic void addChild(String tagName, XMLMarshallable child)
XMLMarshallablechild representing
the marshallable object which must be added to the element.addChild in interface XMLMarshallabletagName - The name of tag for the childchild - The child to be addedpublic void marshalAttributes(XMLOutputter output)
IXMLMarshallablemarshalAttributes in interface IXMLMarshallableoutput - The XML output to marshal the object attributes intopublic void marshalChildren(XMLOutputter output)
IXMLMarshallablemarshalChildren in interface IXMLMarshallableoutput - The XML output to marshal the child objects intopublic void addCharacterData(String cData)
XMLMarshallableaddCharacterData in interface XMLMarshallablecData - The character data to be added@Deprecated public void marshal(XMLOutputter output)
XMLMarshallablemarshal in interface IXMLMarshallablemarshal in interface XMLMarshallableoutput - The XML output to marshal the object into