S - source type in XML-JavaT - target type in Time4Jpublic abstract class XMLAdapter<S,T> extends TemporalType<S,T>
Serves as bridge to temporal types in XML-related Java.
All singleton instances are defined as static constants and are immutable.
| Modifier and Type | Field and Description |
|---|---|
static XMLAdapter<XMLGregorianCalendar,PlainDate> |
XML_DATE
Bridge between a XML-date according to
xsd:date
and the type PlainDate. |
static XMLAdapter<XMLGregorianCalendar,PlainTimestamp> |
XML_DATE_TIME
Bridge between a XML-timestamp according to
xsd:dateTime
(without timezone-offset) and the type PlainTimestamp. |
static XMLAdapter<XMLGregorianCalendar,ZonalDateTime> |
XML_DATE_TIME_OFFSET
Bridge between a XML-timestamp according to
xsd:dateTime
inclusive timezone-offset and the type ZonalDateTime. |
static XMLAdapter<Duration,Duration<IsoUnit>> |
XML_DURATION
Bridge between a XML-duration according to
xsd:duration
and the Time4J-type Duration. |
static XMLAdapter<XMLGregorianCalendar,PlainTime> |
XML_TIME
Bridge between a XML-time according to
xsd:time
and the type PlainTime. |
CLOCK, INSTANT, JAVA_UTIL_DATE, LOCAL_DATE, LOCAL_DATE_TIME, LOCAL_TIME, MILLIS_SINCE_UNIX, THREETEN_DURATION, THREETEN_PERIOD, ZONED_DATE_TIMEpublic static final XMLAdapter<XMLGregorianCalendar,PlainDate> XML_DATE
Bridge between a XML-date according to xsd:date
and the type PlainDate.
Example:
XMLGregorianCalendar xmlGregCal =
DatatypeFactory.newInstance().newXMLGregorianCalendarDate(
2014, 2, 28, 60); // here with optional offset
PlainDate date = XMLAdapter.XML_DATE.translate(xmlGregCal);
System.out.println(date);
// output: 2014-02-28
public static final XMLAdapter<XMLGregorianCalendar,PlainTime> XML_TIME
Bridge between a XML-time according to xsd:time
and the type PlainTime.
Example:
XMLGregorianCalendar xmlGregCal =
DatatypeFactory.newInstance().newXMLGregorianCalendarTime(
21, 45, 30, 0, 60); // here with optional offset
PlainTime time = XMLAdapter.XML_TIME.translate(xmlGregCal);
System.out.println(time);
// output: T21:45:30
Note: The special value T24:00 (midnight at end of day) is mapped to
T00:00 in the value space of XMLGregorianCalendar.
public static final XMLAdapter<XMLGregorianCalendar,PlainTimestamp> XML_DATE_TIME
Bridge between a XML-timestamp according to xsd:dateTime
(without timezone-offset) and the type PlainTimestamp.
Example:
XMLGregorianCalendar xmlGregCal =
DatatypeFactory.newInstance().newXMLGregorianCalendar(
2014, 2, 28, 14, 45, 30, 0, 60);
PlainTimestamp tsp = XMLAdapter.XML_DATE_TIME.translate(xmlGregCal);
System.out.println(tsp);
// output: 2014-02-28T14:45:30
public static final XMLAdapter<XMLGregorianCalendar,ZonalDateTime> XML_DATE_TIME_OFFSET
Bridge between a XML-timestamp according to xsd:dateTime
inclusive timezone-offset and the type ZonalDateTime.
Example:
XMLGregorianCalendar xmlGregCal =
DatatypeFactory.newInstance().newXMLGregorianCalendar(
2014, 2, 28, 14, 45, 30, 0, 60);
ZonalDateTime zdt = XMLAdapter.XML_DATE_TIME_OFFSET.translate(xmlGregCal);
System.out.println(zdt.print(Iso8601Format.EXTENDED_DATE_TIME_OFFSET));
// output: 2014-02-28T14:45:30+01:00
public static final XMLAdapter<Duration,Duration<IsoUnit>> XML_DURATION
Bridge between a XML-duration according to xsd:duration
and the Time4J-type Duration.
Copyright © 2014–2016. All rights reserved.