public class YearMonthDurationAttribute extends AttributeValue
Date objects returned are not, but
these objects are cloned before being returned.| Modifier and Type | Field and Description |
|---|---|
static String |
identifier
Official name of this type
|
| Constructor and Description |
|---|
YearMonthDurationAttribute(boolean negative,
long years,
long months)
Creates a new
YearMonthDurationAttribute that represents
the duration supplied. |
| Modifier and Type | Method and Description |
|---|---|
String |
encode()
Encodes the value in a form suitable for including in XML data like
a request or an obligation.
|
boolean |
equals(Object o)
Returns true if the input is an instance of this class and if its
value equals the value contained in this class.
|
static YearMonthDurationAttribute |
getInstance(Node root)
Returns a new
YearMonthDurationAttribute that represents
the xf:yearMonthDuration at a particular DOM node. |
static YearMonthDurationAttribute |
getInstance(String value)
Returns a new
YearMonthDurationAttribute that represents
the xf:yearMonthDuration value indicated by the string provided. |
long |
getMonths()
Gets the number of months.
|
Object |
getValue()
Get the value represented
|
long |
getYears()
Gets the number of years.
|
int |
hashCode()
Returns the hashcode value used to index and compare this object with
others of the same type.
|
boolean |
isNegative()
Returns true if the duration is negative.
|
String |
toString()
Converts to a String representation.
|
encode, encode, encodeWithTags, evaluate, evaluatesToBag, getChildren, getType, isBag, returnsBagpublic static final String identifier
public YearMonthDurationAttribute(boolean negative,
long years,
long months)
throws IllegalArgumentException
YearMonthDurationAttribute that represents
the duration supplied.negative - true if the duration is negative, false otherwiseyears - the number of years in the duration (must be positive)months - the number of months in the duration (must be positive)IllegalArgumentException - if the total number of months
exceeds Long.MAX_LONG or the number
of months or years is negativepublic static YearMonthDurationAttribute getInstance(Node root) throws ParsingException
YearMonthDurationAttribute that represents
the xf:yearMonthDuration at a particular DOM node.root - the Node that contains the desired valueYearMonthDurationAttribute representing the
appropriate valueParsingException - if any problems occurred while parsingpublic static YearMonthDurationAttribute getInstance(String value) throws ParsingException
YearMonthDurationAttribute that represents
the xf:yearMonthDuration value indicated by the string provided.value - a string representing the desired valueYearMonthDurationAttribute representing the
desired valueParsingException - if any problems occurred while parsingpublic boolean isNegative()
public long getYears()
public long getMonths()
public boolean equals(Object o)
public int hashCode()
public String toString()
public String encode()
encode in class AttributeValueString form of the valuepublic Object getValue()
AttributeValuegetValue in class AttributeValueCopyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.