public class XmlDuration
extends java.lang.Object
Represents an XML Schema duration.
Constructor and Description |
---|
XmlDuration() |
Modifier and Type | Method and Description |
---|---|
static boolean |
equal(XmlDuration left,
XmlDuration right)
Compare two duration values.
|
int |
getDays()
Return days field of duration (non-negative).
|
DayTimeDuration |
getDayTime()
Return day and time fields.
|
int |
getHours()
Return hours field of duration (non-negative).
|
int |
getMinutes()
Return minutes field of duration (non-negative).
|
int |
getMonths()
Return months field of duration (non-negative).
|
int |
getNanos()
Return nanoseconds field of duration (non-negative).
|
int |
getSeconds()
Return seconds field of duration (non-negative).
|
int |
getSign()
Return sign of the duration (+1, 0 or -1).
|
YearMonthDuration |
getYearMonth()
Return year and month fields.
|
int |
getYears()
Return years field of duration (non-negative).
|
static boolean |
notEqual(XmlDuration left,
XmlDuration right)
Compare two duration values.
|
static XmlDuration |
of(int sign,
int years,
int months,
int days,
int hours,
int minutes,
int seconds,
int nanos)
Return a new XML duration.
|
static XmlDuration |
parse(java.lang.String text)
|
java.lang.String |
toString() |
LocalTime |
toTime()
Return (nullable) This duration expressed as a local time (e.g.
|
public static boolean equal(XmlDuration left, XmlDuration right)
Compare two duration values.
left
- (nullable) The first duration for comparison.right
- (nullable) The second duration for comparison.true
if left
is equal to right
, otherwise false
.public DayTimeDuration getDayTime()
Return day and time fields.
public int getDays()
Return days field of duration (non-negative).
public int getHours()
Return hours field of duration (non-negative).
public int getMinutes()
Return minutes field of duration (non-negative).
public int getMonths()
Return months field of duration (non-negative).
public int getNanos()
Return nanoseconds field of duration (non-negative).
public int getSeconds()
Return seconds field of duration (non-negative).
public int getSign()
Return sign of the duration (+1, 0 or -1).
public YearMonthDuration getYearMonth()
Return year and month fields.
public int getYears()
Return years field of duration (non-negative).
public static boolean notEqual(XmlDuration left, XmlDuration right)
Compare two duration values.
left
- (nullable) The first duration for comparison.right
- (nullable) The second duration for comparison.true
if left
is not equal to right
, otherwise false
.public static XmlDuration of(int sign, int years, int months, int days, int hours, int minutes, int seconds, int nanos)
Return a new XML duration.
sign
- The sign field (+1, 0 or -1).years
- The years field (non-negative).months
- The months field (non-negative).days
- The days field (non-negative).hours
- The hours field (non-negative).minutes
- The minutes field (non-negative).seconds
- The seconds field (non-negative).nanos
- The nanos field (non-negative, <= 999999999
).public static XmlDuration 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 java.lang.String toString()
toString
in class java.lang.Object
public LocalTime toTime()
Return (nullable) This duration expressed as a local time (e.g. 00:00:00 to 23:59:59.999*; 24:00:00 for PT24H), or null
if this duration is not expressible as a local time.
null
if this duration is not expressible as a local time.