public class YearMonthDuration extends DataValue
Represents the XML Schema yearMonthDuration type.
Modifier and Type | Method and Description |
---|---|
static YearMonthDuration |
castOptional(DataValue value)
For internal use only.
|
static YearMonthDuration |
castRequired(DataValue value)
For internal use only.
|
static int |
compare(YearMonthDuration left,
YearMonthDuration right)
Compare two yearMonthDuration values.
|
int |
compareTo(YearMonthDuration value)
Compare this yearMonthDuration with another yearMonthDuration.
|
static boolean |
equal(YearMonthDuration left,
YearMonthDuration right)
Compare two yearMonthDuration values.
|
boolean |
equals(java.lang.Object value)
Compare this yearMonthDuration value with another yearMonthDuration value.
|
DataType |
getDataType()
Return data type of the wrapped value.
|
int |
getMonths()
Return months field of duration (non-negative).
|
int |
getSign()
Return sign of the duration (+1, 0 or -1).
|
int |
getYears()
Return years field of duration (non-negative).
|
boolean |
greaterEqual(YearMonthDuration value)
Compare this yearMonthDuration value with another yearMonthDuration value.
|
boolean |
greaterThan(YearMonthDuration value)
Compare this yearMonthDuration value with another yearMonthDuration value.
|
int |
hashCode()
Hash this data value to a number.
|
boolean |
lessEqual(YearMonthDuration value)
Compare this yearMonthDuration value with another yearMonthDuration value.
|
boolean |
lessThan(YearMonthDuration value)
Compare this yearMonthDuration value with another yearMonthDuration value.
|
YearMonthDuration |
normalize()
Return an equivalent value with all fields normalized.
|
boolean |
notEqual(YearMonthDuration value)
Compare this yearMonthDuration value with another yearMonthDuration value.
|
static YearMonthDuration |
of(int sign,
int years,
int months)
Return a new year/month duration.
|
static YearMonthDuration |
parse(java.lang.String text)
|
static boolean |
static_greaterEqual(YearMonthDuration left,
YearMonthDuration right)
Compare two yearMonthDuration values.
|
static boolean |
static_greaterThan(YearMonthDuration left,
YearMonthDuration right)
Compare two yearMonthDuration values.
|
static boolean |
static_lessEqual(YearMonthDuration left,
YearMonthDuration right)
Compare two yearMonthDuration values.
|
static boolean |
static_lessThan(YearMonthDuration left,
YearMonthDuration right)
Compare two yearMonthDuration values.
|
static boolean |
static_notEqual(YearMonthDuration left,
YearMonthDuration right)
Compare two yearMonthDuration values.
|
java.lang.String |
toString()
Convert this data value to a string.
|
cloneMutable, getTypeCode
public static YearMonthDuration castOptional(DataValue value)
For internal use only.
value
- (internal use only)public static YearMonthDuration castRequired(DataValue value)
For internal use only.
value
- (internal use only)public static int compare(YearMonthDuration left, YearMonthDuration right)
Compare two yearMonthDuration values.
left
- The first yearMonthDuration for comparison.right
- The second yearMonthDuration for comparison.left < right
, 0 if left == right
, or 1 if left > right
.public int compareTo(YearMonthDuration value)
Compare this yearMonthDuration with another yearMonthDuration.
value
- The other yearMonthDuration.public static boolean equal(YearMonthDuration left, YearMonthDuration right)
Compare two yearMonthDuration values.
left
- (nullable) The first yearMonthDuration for comparison.right
- (nullable) The second yearMonthDuration for comparison.true
if left
is equal to right
, otherwise false
.public boolean equals(java.lang.Object value)
Compare this yearMonthDuration value with another yearMonthDuration value.
public DataType getDataType()
Return data type of the wrapped value.
getDataType
in class DataValue
public int getMonths()
Return months field of duration (non-negative).
public int getSign()
Return sign of the duration (+1, 0 or -1).
public int getYears()
Return years field of duration (non-negative).
public boolean greaterEqual(YearMonthDuration value)
Compare this yearMonthDuration value with another yearMonthDuration value.
value
- The other yearMonthDuration value.true
if this yearMonthDuration value is greater than or equal to the value yearMonthDuration value. Oherwise false
.public boolean greaterThan(YearMonthDuration value)
Compare this yearMonthDuration value with another yearMonthDuration value.
value
- The other yearMonthDuration value.true
if this yearMonthDuration value is greater than the value yearMonthDuration value. Oherwise false
.public int hashCode()
Hash this data value to a number.
public boolean lessEqual(YearMonthDuration value)
Compare this yearMonthDuration value with another yearMonthDuration value.
value
- The other yearMonthDuration value.true
if this yearMonthDuration value is less than or equal to the value yearMonthDuration value. Oherwise false
.public boolean lessThan(YearMonthDuration value)
Compare this yearMonthDuration value with another yearMonthDuration value.
value
- The other yearMonthDuration value.true
if this yearMonthDuration value is less than the value yearMonthDuration value. Oherwise false
.public YearMonthDuration normalize()
Return an equivalent value with all fields normalized.
The result value will have months < 12.
The result value will be YearMonthDuration.equal
to this value.
public boolean notEqual(YearMonthDuration value)
Compare this yearMonthDuration value with another yearMonthDuration value.
value
- The other yearMonthDuration value.true
if this yearMonthDuration value is not equal to the value yearMonthDuration value. Oherwise false
.public static YearMonthDuration of(int sign, int years, int months)
Return a new year/month duration.
sign
- The sign field (+1, 0 or -1).years
- The years field (non-negative).months
- The months field (non-negative).public static YearMonthDuration parse(java.lang.String text)
Return (nullable) Value parsed from XML Schema format, or null
if text
has invalid duration format.
text
- Value in XML Schema format.null
if text
has invalid duration format.public static boolean static_greaterEqual(YearMonthDuration left, YearMonthDuration right)
Compare two yearMonthDuration values.
left
- The first yearMonthDuration for comparison.right
- The second yearMonthDuration for comparison.true
if left
is greater than or equal to right
, otherwise false
.public static boolean static_greaterThan(YearMonthDuration left, YearMonthDuration right)
Compare two yearMonthDuration values.
left
- The first yearMonthDuration for comparison.right
- The second yearMonthDuration for comparison.true
if left
is greater than right
, otherwise false
.public static boolean static_lessEqual(YearMonthDuration left, YearMonthDuration right)
Compare two yearMonthDuration values.
left
- The first yearMonthDuration for comparison.right
- The second yearMonthDuration for comparison.true
if left
is less than or equal to right
, otherwise false
.public static boolean static_lessThan(YearMonthDuration left, YearMonthDuration right)
Compare two yearMonthDuration values.
left
- The first yearMonthDuration for comparison.right
- The second yearMonthDuration for comparison.true
if left
is less than right
, otherwise false
.public static boolean static_notEqual(YearMonthDuration left, YearMonthDuration right)
Compare two yearMonthDuration values.
left
- (nullable) The first yearMonthDuration for comparison.right
- (nullable) The second yearMonthDuration for comparison.true
if left
is not equal to right
, otherwise false
.public java.lang.String toString()
Convert this data value to a string.
If the YearMonthDuration.dataType
is defined by XML Schema Part 2: Datatypes, then the corresponding lexical format is used.
JSON format is used for structured values (arrays and objects).