XMLGregorianCalendar
abstract class XMLGregorianCalendar : Cloneable
kotlin.Any | |
↳ | javax.xml.datatype.XMLGregorianCalendar |
Representation for W3C XML Schema 1.0 date/time datatypes. Specifically, these date/time datatypes are dateTime
, time
, date
, gYearMonth
, gMonthDay
, gYear
gMonth
and 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.
Date/Time Datatype Field Mapping Between XML Schema 1.0 and Java Representation | ||
---|---|---|
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 24 or DatatypeConstants#FIELD_UNDEFINED . For a value of 24, the minute and second field must be zero per XML Schema Errata. |
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, @{link 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:
- accessors/mutators for independent date/time fields
- conversion between this class and W3C XML Schema 1.0 lexical representation,
toString()
,DatatypeFactory#newXMLGregorianCalendar(String lexicalRepresentation)
- conversion between this class and
GregorianCalendar
,toGregorianCalendar(java.util.TimeZone timezone,java.util.Locale aLocale,javax.xml.datatype.XMLGregorianCalendar)
,DatatypeFactory
- partial order relation comparator method,
compare(javax.xml.datatype.XMLGregorianCalendar)
equals(java.lang.Object)
defined relative tocompare(javax.xml.datatype.XMLGregorianCalendar)
.- addition operation with
Duration
instance as defined in W3C XML Schema 1.0 Part 2, Appendix E, Adding durations to dateTimes.
Summary
Public constructors | |
---|---|
Public methods | |
---|---|
abstract Unit |
Add |
abstract Unit |
clear() Unset all fields to undefined. |
abstract Any |
clone() Creates and returns a copy of this object. |
abstract Int |
compare(xmlGregorianCalendar: XMLGregorianCalendar!) Compare two instances of W3C XML Schema 1. |
open Boolean |
Indicates whether parameter |
abstract Int |
getDay() Return day in month or |
abstract BigInteger! |
getEon() Return high order component for XML Schema 1. |
abstract BigInteger! |
Return XML Schema 1. |
abstract BigDecimal! |
Return fractional seconds. |
abstract Int |
getHour() Return hours or |
open Int |
Return millisecond precision of |
abstract Int |
Return minutes or . |
abstract Int |
getMonth() Return number of month or |
abstract Int |
Return seconds or |
abstract TimeZone! |
getTimeZone(defaultZoneoffset: Int) Returns a |
abstract Int |
Return timezone offset in minutes or |
abstract QName! |
Return the name of the XML Schema date/time type that this instance maps to. |
abstract Int |
getYear() Return low order component for XML Schema 1. |
open Int |
hashCode() Returns a hash code consistent with the definition of the equals method. |
abstract Boolean |
isValid() Validate instance by |
abstract XMLGregorianCalendar! |
Normalize this instance to UTC. |
abstract Unit |
reset() Reset this |
abstract Unit |
Set days in month. |
abstract Unit |
setFractionalSecond(fractional: BigDecimal!) Set fractional seconds. |
abstract Unit |
Set hours. |
abstract Unit |
setMillisecond(millisecond: Int) Set milliseconds. |
abstract Unit |
Set minutes. |
abstract Unit |
Set month. |
abstract Unit |
Set seconds. |
open Unit |
Set time as one unit. |
open Unit |
setTime(hour: Int, minute: Int, second: Int, fractional: BigDecimal!) Set time as one unit, including the optional infinite precision fractional seconds. |
open Unit |
Set time as one unit, including optional milliseconds. |
abstract Unit |
setTimezone(offset: Int) Set the number of minutes in the timezone offset. |
abstract Unit |
setYear(year: BigInteger!) Set low and high order component of XSD |
abstract Unit |
Set year of XSD |
abstract GregorianCalendar! |
Convert this |
abstract GregorianCalendar! |
toGregorianCalendar(timezone: TimeZone!, aLocale: Locale!, defaults: XMLGregorianCalendar!) Convert this |
open String |
toString() Returns a |
abstract String! |
Return the lexical representation of |
Public constructors
Public methods
add
abstract fun add(duration: Duration!): Unit
Add duration
to this instance.
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 dateTime
fields to this class' representation of those fields.
Parameters | |
---|---|
duration |
Duration!: Duration to add to this XMLGregorianCalendar . |
Exceptions | |
---|---|
java.lang.NullPointerException |
when duration parameter is null . |
clear
abstract fun clear(): Unit
Unset all fields to undefined.
Set all int fields to DatatypeConstants#FIELD_UNDEFINED
and reference fields to null.
clone
abstract fun clone(): Any
Creates and returns a copy of this object.
Return | |
---|---|
Any |
copy of this Object |
Exceptions | |
---|---|
java.lang.CloneNotSupportedException |
if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned. |
compare
abstract fun compare(xmlGregorianCalendar: XMLGregorianCalendar!): Int
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.
xsd:dateTime
datatype field mapping to accessors of this class are defined in date/time field mapping table.
Parameters | |
---|---|
xmlGregorianCalendar |
XMLGregorianCalendar!: Instance of XMLGregorianCalendar to compare |
Return | |
---|---|
Int |
The relationship between this XMLGregorianCalendar and the specified xmlGregorianCalendar as DatatypeConstants#LESSER , DatatypeConstants#EQUAL , DatatypeConstants#GREATER or DatatypeConstants#INDETERMINATE . |
Exceptions | |
---|---|
java.lang.NullPointerException |
if xmlGregorianCalendar is null. |
equals
open fun equals(other: Any?): Boolean
Indicates whether parameter obj
is "equal to" this one.
Parameters | |
---|---|
obj |
to compare. |
Return | |
---|---|
Boolean |
true when obj is an instance of XMLGregorianCalendar and compare(javax.xml.datatype.XMLGregorianCalendar) returns DatatypeConstants#EQUAL , otherwise false . |
getDay
abstract fun getDay(): Int
Return day in month or DatatypeConstants#FIELD_UNDEFINED
.
Value constraints for this value are summarized in day field of date/time field mapping table.
See Also
getEon
abstract fun getEon(): BigInteger!
Return high order component for XML Schema 1.0 dateTime datatype field for year
. null
if this optional part of the year field is not defined.
Value constraints for this value are summarized in year field of date/time field mapping table.
Return | |
---|---|
BigInteger! |
eon of this XMLGregorianCalendar . The value returned is an integer multiple of 10^9. |
See Also
getEonAndYear
abstract fun getEonAndYear(): BigInteger!
Return XML Schema 1.0 dateTime datatype field for year
.
Value constraints for this value are summarized in year field of date/time field mapping table.
Return | |
---|---|
BigInteger! |
sum of eon 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 . |
See Also
getFractionalSecond
abstract fun getFractionalSecond(): BigDecimal!
Return fractional seconds.
null
is returned when this optional field is not defined.
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 getSecond()
, does not return DatatypeConstants#FIELD_UNDEFINED
.
Return | |
---|---|
BigDecimal! |
fractional seconds of this XMLGregorianCalendar . |
getHour
abstract fun getHour(): Int
Return hours or DatatypeConstants#FIELD_UNDEFINED
. Returns DatatypeConstants#FIELD_UNDEFINED
if this field is not defined.
Value constraints for this value are summarized in hour field of date/time field mapping table.
See Also
getMillisecond
open fun getMillisecond(): Int
Return millisecond precision of getFractionalSecond()
.
This method represents a convenience accessor to infinite precision fractional second value returned by getFractionalSecond()
. The returned value is the rounded down to milliseconds value of getFractionalSecond()
. When getFractionalSecond()
returns null
, this method must return DatatypeConstants#FIELD_UNDEFINED
.
Value constraints for this value are summarized in second field of date/time field mapping table.
Return | |
---|---|
Int |
Millisecond of this XMLGregorianCalendar . |
getMinute
abstract fun getMinute(): Int
Return minutes or .
ReturnsDatatypeConstants#FIELD_UNDEFINED
if this field is not defined.
Value constraints for this value are summarized in minute field of date/time field mapping table.
See Also
getMonth
abstract fun getMonth(): Int
Return number of month or DatatypeConstants#FIELD_UNDEFINED
.
Value constraints for this value are summarized in month field of date/time field mapping table.
Return | |
---|---|
Int |
year of this XMLGregorianCalendar . |
getSecond
abstract fun getSecond(): Int
Return seconds or DatatypeConstants#FIELD_UNDEFINED
.
Returns DatatypeConstants#FIELD_UNDEFINED
if this field is not defined. When this field is not defined, the optional xs:dateTime fractional seconds field, represented by getFractionalSecond()
and getMillisecond()
, must not be defined.
Value constraints for this value are summarized in second field of date/time field mapping table.
Return | |
---|---|
Int |
Second of this XMLGregorianCalendar . |
getTimeZone
abstract fun getTimeZone(defaultZoneoffset: Int): TimeZone!
Returns a java.util.TimeZone
for this class.
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).
Parameters | |
---|---|
defaultZoneoffset |
Int: default zoneoffset if this zoneoffset is DatatypeConstants#FIELD_UNDEFINED . |
Return | |
---|---|
TimeZone! |
TimeZone for this. |
getTimezone
abstract fun getTimezone(): Int
Return timezone offset in minutes or DatatypeConstants#FIELD_UNDEFINED
if this optional field is not defined.
Value constraints for this value are summarized in timezone field of date/time field mapping table.
See Also
getXMLSchemaType
abstract fun getXMLSchemaType(): QName!
Return the name of the XML Schema date/time type that this instance maps to. Type is computed based on fields that are set.
Required fields for XML Schema 1.0 Date/Time Datatypes. (timezone is optional for all date/time datatypes) |
||||||
---|---|---|---|---|---|---|
Datatype | year | month | day | hour | minute | second |
DatatypeConstants#DATETIME |
X | X | X | X | X | X |
DatatypeConstants#DATE |
X | X | X | |||
DatatypeConstants#TIME |
X | X | X | |||
DatatypeConstants#GYEARMONTH |
X | X | ||||
DatatypeConstants#GMONTHDAY |
X | X | ||||
DatatypeConstants#GYEAR |
X | |||||
DatatypeConstants#GMONTH |
X | |||||
DatatypeConstants#GDAY |
X |
Return | |
---|---|
QName! |
One of the following class constants: DatatypeConstants#DATETIME , DatatypeConstants#TIME , DatatypeConstants#DATE , DatatypeConstants#GYEARMONTH , DatatypeConstants#GMONTHDAY , DatatypeConstants#GYEAR , DatatypeConstants#GMONTH or DatatypeConstants#GDAY . |
Exceptions | |
---|---|
java.lang.IllegalStateException |
if the combination of set fields does not match one of the eight defined XML Schema builtin date/time datatypes. |
getYear
abstract fun getYear(): Int
Return low order component for XML Schema 1.0 dateTime datatype field for year
or DatatypeConstants#FIELD_UNDEFINED
.
Value constraints for this value are summarized in year field of date/time field mapping table.
Return | |
---|---|
Int |
year of this XMLGregorianCalendar . |
See Also
hashCode
open fun hashCode(): Int
Returns a hash code consistent with the definition of the equals method.
Return | |
---|---|
Int |
hash code of this object. |
isValid
abstract fun isValid(): Boolean
Validate instance by getXMLSchemaType()
constraints.
Return | |
---|---|
Boolean |
true if data values are valid. |
normalize
abstract fun normalize(): XMLGregorianCalendar!
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).
Return | |
---|---|
XMLGregorianCalendar! |
this XMLGregorianCalendar normalized to UTC. |
reset
abstract fun reset(): Unit
Reset this XMLGregorianCalendar
to its original values.
XMLGregorianCalendar
is reset to the same values as when it was created with DatatypeFactory#newXMLGregorianCalendar()
, DatatypeFactory#newXMLGregorianCalendar(String lexicalRepresentation)
, DatatypeFactory#newXMLGregorianCalendar(
, DatatypeFactory#newXMLGregorianCalendar(
, DatatypeFactory#newXMLGregorianCalendar(GregorianCalendar cal)
, DatatypeFactory#newXMLGregorianCalendarDate(
, DatatypeFactory#newXMLGregorianCalendarTime(
, DatatypeFactory#newXMLGregorianCalendarTime(
or DatatypeFactory#newXMLGregorianCalendarTime(
.
reset()
is designed to allow the reuse of existing XMLGregorianCalendar
s thus saving resources associated with the creation of new XMLGregorianCalendar
s.
setDay
abstract fun setDay(day: Int): Unit
Set days in month.
Unset this field by invoking the setter with a parameter value of DatatypeConstants#FIELD_UNDEFINED
.
Parameters | |
---|---|
day |
Int: value constraints summarized in day field of date/time field mapping table. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if day parameter is outside value constraints for the field as specified in date/time field mapping table. |
setFractionalSecond
abstract fun setFractionalSecond(fractional: BigDecimal!): Unit
Set fractional seconds.
Unset this field by invoking the setter with a parameter value of null
.
Parameters | |
---|---|
fractional |
BigDecimal!: value constraints summarized in fractional field of date/time field mapping table. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if fractional parameter is outside value constraints for the field as specified in date/time field mapping table. |
setHour
abstract fun setHour(hour: Int): Unit
Set hours.
Unset this field by invoking the setter with a parameter value of DatatypeConstants#FIELD_UNDEFINED
.
Parameters | |
---|---|
hour |
Int: value constraints summarized in hour field of date/time field mapping table. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if hour parameter is outside value constraints for the field as specified in date/time field mapping table. |
setMillisecond
abstract fun setMillisecond(millisecond: Int): Unit
Set milliseconds.
Unset this field by invoking the setter with a parameter value of DatatypeConstants#FIELD_UNDEFINED
.
Parameters | |
---|---|
millisecond |
Int: value constraints summarized in millisecond field of date/time field mapping table. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if millisecond parameter is outside value constraints for the field as specified in date/time field mapping table. |
setMinute
abstract fun setMinute(minute: Int): Unit
Set minutes.
Unset this field by invoking the setter with a parameter value of DatatypeConstants#FIELD_UNDEFINED
.
Parameters | |
---|---|
minute |
Int: value constraints summarized in minute field of date/time field mapping table. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if minute parameter is outside value constraints for the field as specified in date/time field mapping table. |
setMonth
abstract fun setMonth(month: Int): Unit
Set month.
Unset this field by invoking the setter with a parameter value of DatatypeConstants#FIELD_UNDEFINED
.
Parameters | |
---|---|
month |
Int: value constraints summarized in month field of date/time field mapping table. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if month parameter is outside value constraints for the field as specified in date/time field mapping table. |
setSecond
abstract fun setSecond(second: Int): Unit
Set seconds.
Unset this field by invoking the setter with a parameter value of DatatypeConstants#FIELD_UNDEFINED
.
Parameters | |
---|---|
second |
Int: value constraints summarized in second field of date/time field mapping table. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if second parameter is outside value constraints for the field as specified in date/time field mapping table. |
setTime
open fun setTime(
hour: Int,
minute: Int,
second: Int
): Unit
Set time as one unit.
Parameters | |
---|---|
hour |
Int: value constraints are summarized in hour field of date/time field mapping table. |
minute |
Int: value constraints are summarized in minute field of date/time field mapping table. |
second |
Int: value constraints are summarized in second field of date/time field mapping table. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if any parameter is outside value constraints for the field as specified in date/time field mapping table. |
See Also
setTime
open fun setTime(
hour: Int,
minute: Int,
second: Int,
fractional: BigDecimal!
): Unit
Set time as one unit, including the optional infinite precision fractional seconds.
Parameters | |
---|---|
hour |
Int: value constraints are summarized in hour field of date/time field mapping table. |
minute |
Int: value constraints are summarized in minute field of date/time field mapping table. |
second |
Int: value constraints are summarized in second field of date/time field mapping table. |
fractional |
BigDecimal!: value of null indicates this optional field is not set. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if any parameter is outside value constraints for the field as specified in date/time field mapping table. |
setTime
open fun setTime(
hour: Int,
minute: Int,
second: Int,
millisecond: Int
): Unit
Set time as one unit, including optional milliseconds.
Parameters | |
---|---|
hour |
Int: value constraints are summarized in hour field of date/time field mapping table. |
minute |
Int: value constraints are summarized in minute field of date/time field mapping table. |
second |
Int: value constraints are summarized in second field of date/time field mapping table. |
millisecond |
Int: value of DatatypeConstants#FIELD_UNDEFINED indicates this optional field is not set. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if any parameter is outside value constraints for the field as specified in date/time field mapping table. |
setTimezone
abstract fun setTimezone(offset: Int): Unit
Set the number of minutes in the timezone offset.
Unset this field by invoking the setter with a parameter value of DatatypeConstants#FIELD_UNDEFINED
.
Parameters | |
---|---|
offset |
Int: value constraints summarized in timezone field of date/time field mapping table. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if offset parameter is outside value constraints for the field as specified in date/time field mapping table. |
setYear
abstract fun setYear(year: BigInteger!): Unit
Set low and high order component of XSD dateTime
year field.
Unset this field by invoking the setter with a parameter value of null
.
Parameters | |
---|---|
year |
BigInteger!: value constraints summarized in year field of date/time field mapping table. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if year parameter is outside value constraints for the field as specified in date/time field mapping table. |
setYear
abstract fun setYear(year: Int): Unit
Set year of XSD dateTime
year field.
Unset this field by invoking the setter with a parameter value of DatatypeConstants#FIELD_UNDEFINED
.
Note: if the absolute value of the year
parameter is less than 10^9, the eon component of the XSD year field is set to null
by this method.
Parameters | |
---|---|
year |
Int: value constraints are summarized in year field of date/time field mapping table. If year is DatatypeConstants#FIELD_UNDEFINED , then eon is set to null . |
toGregorianCalendar
abstract fun toGregorianCalendar(): GregorianCalendar!
Convert this XMLGregorianCalendar
to a GregorianCalendar
.
When this
instance has an undefined field, this conversion relies on the java.util.GregorianCalendar
default for its corresponding field. A notable difference between XML Schema 1.0 date/time datatypes and java.util.GregorianCalendar
is that Timezone value is optional for date/time datatypes and it is a required field for java.util.GregorianCalendar
. See javadoc for java.util.TimeZone.getDefault()
on how the default is determined. To explicitly specify the TimeZone
instance, see #toGregorianCalendar(java.util.TimeZone,Locale,javax.xml.datatype.XMLGregorianCalendar).
Field by Field Conversion from this class to java.util.GregorianCalendar |
|
---|---|
java.util.GregorianCalendar field |
javax.xml.datatype.XMLGregorianCalendar field |
ERA |
getEonAndYear() .signum() < 0 ? GregorianCalendar.BC : GregorianCalendar.AD |
YEAR |
getEonAndYear() .abs().intValue() * |
MONTH |
getMonth() - DatatypeConstants#JANUARY + GregorianCalendar#JANUARY |
DAY_OF_MONTH |
getDay() |
HOUR_OF_DAY |
getHour() |
MINUTE |
getMinute() |
SECOND |
getSecond() |
MILLISECOND |
get millisecond order from getFractionalSecond() * |
GregorianCalendar.setTimeZone(TimeZone) |
getTimezone() formatted into Custom timezone id |
To ensure consistency in conversion implementations, the new GregorianCalendar
should be instantiated in following manner.
- Using
timeZone
value as defined above, create a newjava.util.GregorianCalendar(timeZone,Locale.getDefault())
. - Initialize all GregorianCalendar fields by calling {(@link GegorianCalendar#clear()}.
- Obtain a pure Gregorian Calendar by invoking
GregorianCalendar.setGregorianChange( new Date(Long.MIN_VALUE))
. - Its fields ERA, YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE, SECOND and MILLISECOND are set using the method
Calendar.set(int,int)
toGregorianCalendar
abstract fun toGregorianCalendar(
timezone: TimeZone!,
aLocale: Locale!,
defaults: XMLGregorianCalendar!
): GregorianCalendar!
Convert this XMLGregorianCalendar
along with provided parameters to a GregorianCalendar
instance.
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 timezone
parameter.
To compute the return value's TimeZone
field,
- when parameter
timeZone
is non-null, it is the timezone field. - else when
this.getTimezone() != FIELD_UNDEFINED
, create ajava.util.TimeZone
with a custom timezone id using thethis.getTimezone()
. - else when
defaults.getTimezone() != FIELD_UNDEFINED
, create ajava.util.TimeZone
with a custom timezone id usingdefaults.getTimezone()
. - else use the
GregorianCalendar
default timezone value for the host is defined as specified byjava.util.TimeZone.getDefault()
.
To ensure consistency in conversion implementations, the new GregorianCalendar
should be instantiated in following manner.
- Create a new
java.util.GregorianCalendar(TimeZone, Locale)
with TimeZone set as specified above and theLocale
parameter. - Initialize all GregorianCalendar fields by calling
GregorianCalendar#clear()
- Obtain a pure Gregorian Calendar by invoking
GregorianCalendar.setGregorianChange( new Date(Long.MIN_VALUE))
. - Its fields ERA, YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE, SECOND and MILLISECOND are set using the method
Calendar.set(int,int)
Parameters | |
---|---|
timezone |
TimeZone!: provide Timezone. null is a legal value. |
aLocale |
Locale!: provide explicit Locale. Use default GregorianCalendar locale if value is null . |
defaults |
XMLGregorianCalendar!: provide default field values to use when corresponding field for this instance is FIELD_UNDEFINED or null. If defaults is null or a field within the specified defaults is undefined, just use java.util.GregorianCalendar defaults. |
Return | |
---|---|
GregorianCalendar! |
a java.util.GregorianCalendar conversion of this instance. |
toString
open fun toString(): String
Returns a String
representation of this XMLGregorianCalendar
Object
.
The result is a lexical representation generated by toXMLFormat()
.
Return | |
---|---|
String |
A non-null valid String representation of this XMLGregorianCalendar . |
Exceptions | |
---|---|
java.lang.IllegalStateException |
if the combination of set fields does not match one of the eight defined XML Schema builtin date/time datatypes. |
See Also
toXMLFormat
abstract fun toXMLFormat(): String!
Return the lexical representation of this
instance. The format is specified in XML Schema 1.0 Part 2, Section 3.2.[7-14].1, Lexical Representation".
Specific target lexical representation format is determined by getXMLSchemaType()
.
Return | |
---|---|
String! |
XML, as String , representation of this XMLGregorianCalendar |
Exceptions | |
---|---|
java.lang.IllegalStateException |
if the combination of set fields does not match one of the eight defined XML Schema builtin date/time datatypes. |