Representation for W3C XML Schema 1.0 date/time datatypes.
Specifically, these date/time datatypes are
DatatypeConstants#DATETIME,
DatatypeConstants#TIME,
DatatypeConstants#DATE,
DatatypeConstants#GYEARMONTH,
DatatypeConstants#GMONTHDAY,
DatatypeConstants#GYEAR,
DatatypeConstants#GMONTH, and
DatatypeConstants#GDAY
defined in the XML Namespace
"http://www.w3.org/2001/XMLSchema".
These datatypes are normatively defined in
W3C XML Schema 1.0 Part 2, Section 3.2.7-14.
The table below defines the mapping between XML Schema 1.0 date/time datatype fields and this class' fields. It also summarizes the value constraints for the date and time fields defined in W3C XML Schema 1.0 Part 2, Appendix D, ISO 8601 Date and Time Formats.
| XML Schema 1.0 datatype field |
Related XMLGregorianCalendar Accessor(s) |
Value Range |
|---|---|---|
| year | getYear() + getEon() orgetEonAndYear
|
getYear() is a value between -(10^9-1) to (10^9)-1
or DatatypeConstants#FIELD_UNDEFINED.getEon() is high order year value in billion of years.getEon() has values greater than or equal to (10^9) or less than or equal to -(10^9).
A value of null indicates field is undefined.Given that XML Schema 1.0 errata states that the year zero will be a valid lexical value in a future version of XML Schema, this class allows the year field to be set to zero. Otherwise, the year field value is handled exactly as described in the errata and [ISO-8601-1988]. Note that W3C XML Schema 1.0 validation does not allow for the year field to have a value of zero. |
| month | getMonth() |
1 to 12 or DatatypeConstants#FIELD_UNDEFINED |
| day | getDay() |
Independent of month, max range is 1 to 31 or DatatypeConstants#FIELD_UNDEFINED.The normative value constraint stated relative to month field's value is in W3C XML Schema 1.0 Part 2, Appendix D. |
| hour | getHour() |
0 to 23 or DatatypeConstants#FIELD_UNDEFINED.
An hour value of 24 is allowed to be set in the lexical space provided the minute and second
field values are zero. However, an hour value of 24 is not allowed in value space and will be
transformed to represent the value of the first instance of the following day as per
XML Schema Part 2: Datatypes Second Edition, 3.2 Primitive datatypes.
|
| minute | getMinute() |
0 to 59 or DatatypeConstants#FIELD_UNDEFINED |
| second |
getSecond() + getMillisecond()/1000 orgetSecond() + getFractionalSecond()
|
getSecond() from 0 to 60 or DatatypeConstants#FIELD_UNDEFINED.(Note: 60 only allowable for leap second.) getFractionalSecond() allows for infinite precision over the range from 0.0 to 1.0 when
the getSecond() is defined.FractionalSecond is optional and has a value of null when it is undefined.getMillisecond() is the convenience
millisecond precision of value of getFractionalSecond().
|
| timezone | getTimezone() |
Number of minutes or DatatypeConstants#FIELD_UNDEFINED.
Value range from -14 hours (-14 * 60 minutes) to 14 hours (14 * 60 minutes).
|
All maximum value space constraints listed for the fields in the table
above are checked by factory methods, DatatypeFactory,
setter methods and parse methods of
this class. IllegalArgumentException is thrown when a
parameter's value is outside the value constraint for the field or
if the composite
values constitute an invalid XMLGregorianCalendar instance (for example, if
the 31st of June is specified).
The following operations are defined for this class:
toString(), DatatypeFactory#newXMLGregorianCalendar(String lexicalRepresentation)GregorianCalendar,
toGregorianCalendar(java.util.TimeZone timezone, java.util.Locale aLocale, XMLGregorianCalendar defaults) ,
DatatypeFactorycompare(XMLGregorianCalendar xmlGregorianCalendar)equals(Object) defined relative to compare(XMLGregorianCalendar xmlGregorianCalendar).Duration
instance as defined in
W3C XML Schema 1.0 Part 2, Appendix E, Adding durations to dateTimes.
Duration, DatatypeFactory
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public abstract void | |
| public abstract void | |
| public abstract Object | Returns: copy of thisObjectOverrides java. Creates and returns a copy of this object. |
| public abstract int | Returns: The relationship betweenthis XMLGregorianCalendar and
the specified xmlGregorianCalendar as
DatatypeConstants#LESSER,
DatatypeConstants#EQUAL,
DatatypeConstants#GREATER or
DatatypeConstants#INDETERMINATE.Instance of xmlGregorianCalendar)XMLGregorianCalendar to compareCompare two instances of W3C XML Schema 1.0 date/time datatypes according to partial order relation defined in W3C XML Schema 1.0 Part 2, Section 3.2.7.3, Order relation on dateTime. |
| public boolean | Returns: true when obj is an instance of
XMLGregorianCalendar and
compare(XMLGregorianCalendar obj)
returns DatatypeConstants#EQUAL,
otherwise false.to compare. obj)Overrides java. Compares this calendar to the specified object. |
| public abstract int | Returns: The day of month of thisXMLGregorianCalendar, from 1 to 31.Returns the day of month or |
| public abstract BigInteger | Returns: The eon of thisXMLGregorianCalendar. The value
returned is an integer multiple of 10^9.Returns the high order component for XML Schema 1.0 dateTime datatype field for
|
| public abstract BigInteger | Returns: sum ofeon and BigInteger.valueOf(year)
when both fields are defined. When only year is defined,
return it. When both eon and year are not
defined, return null.Returns the XML Schema 1.0 dateTime datatype field for
|
| public abstract BigDecimal | Returns: Fractional seconds of thisXMLGregorianCalendar.Returns fractional seconds. |
| public abstract int | Returns: The hour of day of thisXMLGregorianCalendar, from 0 to 23.Returns the hour of day or
|
| public int | Returns: The millisecond precision of thisXMLGregorianCalendar.Returns the millisecond precision of |
| public abstract int | Returns: The minute of hour of thisXMLGregorianCalendar, from 0 to 59.Returns the minute of hour or
|
| public abstract int | Returns: The month of thisXMLGregorianCalendar, from 1 to 12.Returns the month of this calendar or |
| public abstract int | Returns: The second of minute of thisXMLGregorianCalendar, from 0 to 59.Returns the second of minute or
|
| public abstract int | Returns: The Timezone offset in minutes of thisXMLGregorianCalendar.Returns the Timezone offset in minutes or
|
| public abstract TimeZone | Returns: TimeZone for this.default zoneoffset if this zoneoffset is
defaultZoneoffset)DatatypeConstants#FIELD_UNDEFINED.Returns a |
| public abstract QName | Returns: One of the following class constants:DatatypeConstants#DATETIME,
DatatypeConstants#TIME,
DatatypeConstants#DATE,
DatatypeConstants#GYEARMONTH,
DatatypeConstants#GMONTHDAY,
DatatypeConstants#GYEAR,
DatatypeConstants#GMONTH or
DatatypeConstants#GDAY.Return the name of the XML Schema date/time type that this instance maps to. |
| public abstract int | Returns: The year of thisXMLGregorianCalendar.Returns the low order component for XML Schema 1.0 dateTime datatype field for
|
| public int | Returns: hash code of this object.Overrides java. Returns a hash code consistent with the definition of the equals method. |
| public abstract boolean | Returns: true if data values are valid.Validate instance by |
| public abstract XMLGregorianCalendar | |
| public abstract void | |
| public abstract void | setDay(int
value constraints summarized in day field of date/time field mapping table. day)Set days in month. |
| public abstract void | setFractionalSecond(BigDecimal
value constraints summarized in
second field of date/time field mapping table. fractional)Set fractional seconds. |
| public abstract void | setHour(int
value constraints summarized in hour field of date/time field mapping table. hour)Set hours. |
| public abstract void | setMillisecond(int
value constraints summarized in
second field of date/time field mapping table. millisecond)Set milliseconds. |
| public abstract void | setMinute(int
value constraints summarized in minute field of date/time field mapping table. minute)Set minutes. |
| public abstract void | setMonth(int
value constraints summarized in month field of date/time field mapping table. month)Set month. |
| public abstract void | setSecond(int
value constraints summarized in second field of date/time field mapping table. second)Set seconds. |
| public void | setTime(int
value constraints are summarized in
hour field of date/time field mapping table. hour, int value constraints are summarized in
minute field of date/time field mapping table. minute, int value constraints are summarized in
second field of date/time field mapping table. second)Set time as one unit. |
| public void | setTime(int
value constraints are summarized in
hour field of date/time field mapping table. hour, int value constraints are summarized in
minute field of date/time field mapping table. minute, int value constraints are summarized in
second field of date/time field mapping table. second, BigDecimal value of fractional)null indicates this optional
field is not set.Set time as one unit, including the optional infinite precision fractional seconds. |
| public void | setTime(int
value constraints are summarized in
hour field of date/time field mapping table. hour, int value constraints are summarized in
minute field of date/time field mapping table. minute, int value constraints are summarized in
second field of date/time field mapping table. second, int value of millisecond)DatatypeConstants#FIELD_UNDEFINED indicates this
optional field is not set.Set time as one unit, including optional milliseconds. |
| public abstract void | setTimezone(int
value constraints summarized in
timezone field of date/time field mapping table. offset)Set the number of minutes in the timezone offset. |
| public abstract void | setYear(BigInteger
value constraints summarized in year field of date/time field mapping table. year)Set low and high order component of XSD |
| public abstract void | setYear(int
value constraints are summarized in year field of date/time field mapping table.
If year is year)DatatypeConstants#FIELD_UNDEFINED, then eon is set to null.Set year of XSD |
| public abstract GregorianCalendar | Returns: An instance ofjava..Convert this |
| public abstract GregorianCalendar | Returns: a java.util.GregorianCalendar conversion of this instance.provide Timezone. timezone, Locale null is a legal value.provide explicit Locale. Use default GregorianCalendar locale if
value is aLocale, XMLGregorianCalendar null.provide default field values to use when corresponding
field for this instance is FIELD_UNDEFINED or null.
If defaults)defaultsis null or a field
within the specified defaults is undefined,
just use java.util.GregorianCalendar defaults.Convert this |
| public String | Returns: A non-null valid String representation of this XMLGregorianCalendar.Overrides java. Returns a |
| public abstract String | Returns: XML, asString, representation of this XMLGregorianCalendarReturn the lexical representation of |
| XMLGregorianCalendar | back to summary |
|---|---|
| public XMLGregorianCalendar() Default no-arg constructor. Note Always use the | |
| add | back to summary |
|---|---|
| public abstract void add(Duration duration) Add The computation is specified in
XML Schema 1.0 Part 2, Appendix E,
Adding durations to dateTimes.
date/time field mapping table
defines the mapping from XML Schema 1.0
| |
| clear | back to summary |
|---|---|
| public abstract void clear() Unset all fields to undefined. Set all int fields to | |
| clone | back to summary |
|---|---|
| public abstract Object clone() Overrides java. Creates and returns a copy of this object. | |
| compare | back to summary |
|---|---|
| public abstract int compare(XMLGregorianCalendar xmlGregorianCalendar) Compare two instances of W3C XML Schema 1.0 date/time datatypes according to partial order relation defined in W3C XML Schema 1.0 Part 2, Section 3.2.7.3, Order relation on dateTime.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Compares this calendar to the specified object. The result is
| |
| getDay | back to summary |
|---|---|
| public abstract int getDay() Returns the day of month or Value constraints for this value are summarized in day field of date/time field mapping table.
| |
| getEon | back to summary |
|---|---|
| public abstract BigInteger getEon() Returns the high order component for XML Schema 1.0 dateTime datatype field for
Value constraints for this value are summarized in year field of date/time field mapping table.
| |
| getEonAndYear | back to summary |
|---|---|
| public abstract BigInteger getEonAndYear() Returns the XML Schema 1.0 dateTime datatype field for
Value constraints for this value are summarized in year field of date/time field mapping table.
| |
| getFractionalSecond | back to summary |
|---|---|
| public abstract BigDecimal getFractionalSecond() Returns fractional seconds.
Value constraints are detailed in second field of date/time field mapping table. This optional field can only have a defined value when the
xs:dateTime second field, represented by
| |
| getHour | back to summary |
|---|---|
| public abstract int getHour() Returns the hour of day or
Value constraints for this value are summarized in hour field of date/time field mapping table.
| |
| getMillisecond | back to summary |
|---|---|
| public int getMillisecond() Returns the millisecond precision of This method represents a convenience accessor to infinite
precision fractional second value returned by
Value constraints for this value are summarized in second field of date/time field mapping table.
| |
| getMinute | back to summary |
|---|---|
| public abstract int getMinute() Returns the minute of hour or
Value constraints for this value are summarized in minute field of date/time field mapping table.
| |
| getMonth | back to summary |
|---|---|
| public abstract int getMonth() Returns the month of this calendar or Value constraints for this value are summarized in month field of date/time field mapping table.
| |
| getSecond | back to summary |
|---|---|
| public abstract int getSecond() Returns the second of minute or
Value constraints for this value are summarized in second field of date/time field mapping table.
| |
| getTimezone | back to summary |
|---|---|
| public abstract int getTimezone() Returns the Timezone offset in minutes or
Value constraints for this value are summarized in timezone field of date/time field mapping table.
| |
| getTimeZone | back to summary |
|---|---|
| public abstract TimeZone getTimeZone(int defaultZoneoffset) Returns a If timezone field is defined for this instance, returns TimeZone initialized with custom timezone id of zoneoffset. If timezone field is undefined, try the defaultZoneoffset that was passed in. If defaultZoneoffset is FIELD_UNDEFINED, return default timezone for this host. (Same default as java.util.GregorianCalendar).
| |
| getXMLSchemaType | back to summary | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| public abstract QName getXMLSchemaType() Return the name of the XML Schema date/time type that this instance maps to. Type is computed based on fields that are set.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getYear | back to summary |
|---|---|
| public abstract int getYear() Returns the low order component for XML Schema 1.0 dateTime datatype field for
Value constraints for this value are summarized in year field of date/time field mapping table.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns a hash code consistent with the definition of the equals method.
| |
| isValid | back to summary |
|---|---|
| public abstract boolean isValid() Validate instance by
| |
| normalize | back to summary |
|---|---|
| public abstract XMLGregorianCalendar normalize() Normalize this instance to UTC. 2000-03-04T23:00:00+03:00 normalizes to 2000-03-04T20:00:00Z Implements W3C XML Schema Part 2, Section 3.2.7.3 (A).
| |
| setDay | back to summary |
|---|---|
| public abstract void setDay(int day) Set days in month. Unset this field by invoking the setter with a parameter value of
| |
| setFractionalSecond | back to summary |
|---|---|
| public abstract void setFractionalSecond(BigDecimal fractional) Set fractional seconds. Unset this field by invoking the setter with a parameter value of
| |
| setHour | back to summary |
|---|---|
| public abstract void setHour(int hour) Set hours. Unset this field by invoking the setter with a parameter value of
| |
| setMillisecond | back to summary |
|---|---|
| public abstract void setMillisecond(int millisecond) Set milliseconds. Unset this field by invoking the setter with a parameter value of
| |
| setMinute | back to summary |
|---|---|
| public abstract void setMinute(int minute) Set minutes. Unset this field by invoking the setter with a parameter value of
| |
| setMonth | back to summary |
|---|---|
| public abstract void setMonth(int month) Set month. Unset this field by invoking the setter with a parameter value of
| |
| setSecond | back to summary |
|---|---|
| public abstract void setSecond(int second) Set seconds. Unset this field by invoking the setter with a parameter value of
| |
| setTime | back to summary |
|---|---|
| public void setTime(int hour, int minute, int second) Set time as one unit.
| |
| setTime | back to summary |
|---|---|
| public void setTime(int hour, int minute, int second, BigDecimal fractional) Set time as one unit, including the optional infinite precision fractional seconds.
| |
| setTime | back to summary |
|---|---|
| public void setTime(int hour, int minute, int second, int millisecond) Set time as one unit, including optional milliseconds.
| |
| setTimezone | back to summary |
|---|---|
| public abstract void setTimezone(int offset) Set the number of minutes in the timezone offset. Unset this field by invoking the setter with a parameter value of
| |
| setYear | back to summary |
|---|---|
| public abstract void setYear(BigInteger year) Set low and high order component of XSD Unset this field by invoking the setter with a parameter value of
| |
| setYear | back to summary |
|---|---|
| public abstract void setYear(int year) Set year of XSD Unset this field by invoking the setter with a parameter value of
Note if the absolute value of the
| |
| toGregorianCalendar | back to summary | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| public abstract GregorianCalendar toGregorianCalendar() Convert this When
To ensure consistency in conversion implementations, the new
| |||||||||||||||||||||
| toGregorianCalendar | back to summary |
|---|---|
| public abstract GregorianCalendar toGregorianCalendar(TimeZone timezone, Locale aLocale, XMLGregorianCalendar defaults) Convert this Since XML Schema 1.0 date/time datetypes has no concept of
timezone ids or daylight savings timezone ids, this conversion operation
allows the user to explicitly specify one with
To compute the return value's
To ensure consistency in conversion implementations, the new
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a The result is a lexical representation generated by
| |
| toXMLFormat | back to summary |
|---|---|
| public abstract String toXMLFormat() Return the lexical representation of Specific target lexical representation format is determined by
| |