Package net.time4j.xml
Class XMLAdapter<S,T>
java.lang.Object
net.time4j.TemporalType<S,T>
net.time4j.xml.XMLAdapter<S,T>
- Type Parameters:
S- source type in XML-JavaT- target type in Time4J
- All Implemented Interfaces:
Converter<S,T>
Serves as bridge to temporal types in XML-related Java.
All singleton instances are defined as static constants and are immutable.
- Since:
- 3.0
- Author:
- Meno Hochschild
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic XMLAdapter<XMLGregorianCalendar,PlainDate>Bridge between a XML-date according toxsd:dateand the typePlainDate.static XMLAdapter<XMLGregorianCalendar,PlainTimestamp>Bridge between a XML-timestamp according toxsd:dateTime(without timezone-offset) and the typePlainTimestamp.static XMLAdapter<XMLGregorianCalendar,ZonalDateTime>Bridge between a XML-timestamp according toxsd:dateTimeinclusive timezone-offset and the typeZonalDateTime.static XMLAdapter<Duration,Duration<IsoUnit>>Bridge between a XML-duration according toxsd:durationand the Time4J-typeDuration.static XMLAdapter<XMLGregorianCalendar,PlainTime>Bridge between a XML-time according toxsd:timeand the typePlainTime.Fields inherited from class net.time4j.TemporalType
CLOCK, INSTANT, JAVA_UTIL_CALENDAR, JAVA_UTIL_DATE, JAVA_UTIL_TIMEZONE, LOCAL_DATE, LOCAL_DATE_TIME, LOCAL_TIME, MILLIS_SINCE_UNIX, THREETEN_DURATION, THREETEN_PERIOD, ZONED_DATE_TIME -
Method Summary
Methods inherited from class net.time4j.TemporalType
from, translateMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.time4j.engine.Converter
getSourceType
-
Field Details
-
XML_DATE
Bridge between a XML-date according to
xsd:dateand the typePlainDate.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- Since:
- 3.0
-
XML_TIME
Bridge between a XML-time according to
xsd:timeand the typePlainTime.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:30Note: The special value T24:00 (midnight at end of day) is mapped to T00:00 in the value space of
XMLGregorianCalendar.- Since:
- 3.0
-
XML_DATE_TIME
Bridge between a XML-timestamp according to
xsd:dateTime(without timezone-offset) and the typePlainTimestamp.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- Since:
- 3.0
-
XML_DATE_TIME_OFFSET
Bridge between a XML-timestamp according to
xsd:dateTimeinclusive timezone-offset and the typeZonalDateTime.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- Since:
- 3.0
-
XML_DURATION
Bridge between a XML-duration according to
xsd:durationand the Time4J-typeDuration.- Since:
- 3.0
-