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.
|
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, encodeWithTags, evaluate, evaluatesToBag, getChildren, getType, isBag, returnsBag
public 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 AttributeValue
String
form of the valueCopyright © 2024 WSO2. All rights reserved.