public class ZuluDateTimeAdapter
extends javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,javax.xml.datatype.XMLGregorianCalendar>
Marshals the date time as a Zulu time with format YYYY-MM-DDThh:mm:ss[.sss]Z which is aligned with ISO 8601. Dislike the default jaxb implementation, this adapter will always print the Z The fractional seconds is printed only when it is different from zero.
Notice the configured adapter in the model is the IsoDateTimeAdapter wrapper class, but you can pass this
default implementation or your own in the constructor.
TypeAdaptersConfiguration| Constructor and Description |
|---|
ZuluDateTimeAdapter()
Creates a date time adapter with the default format
|
ZuluDateTimeAdapter(java.text.SimpleDateFormat dateFormat)
Creates a time adapter with a specific given format that will be used for both the marshalling and unmarshalling
|
ZuluDateTimeAdapter(javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,javax.xml.datatype.XMLGregorianCalendar> customAdapterImpl)
Creates a date time adapter injecting a custom implementation
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
marshal(javax.xml.datatype.XMLGregorianCalendar cal)
Applies the configured format to the calendar.
|
javax.xml.datatype.XMLGregorianCalendar |
unmarshal(java.lang.String value)
Creates a calendar parsing the value with this adapter format, or the default lexical representation as fallback.
|
public ZuluDateTimeAdapter()
public ZuluDateTimeAdapter(java.text.SimpleDateFormat dateFormat)
public ZuluDateTimeAdapter(javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,javax.xml.datatype.XMLGregorianCalendar> customAdapterImpl)
public javax.xml.datatype.XMLGregorianCalendar unmarshal(java.lang.String value)
throws java.lang.Exception
unmarshal in class javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,javax.xml.datatype.XMLGregorianCalendar>value - the XML date time value to convertjava.lang.Exceptionpublic java.lang.String marshal(javax.xml.datatype.XMLGregorianCalendar cal)
throws java.lang.Exception
marshal in class javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,javax.xml.datatype.XMLGregorianCalendar>cal - the model calendar to marshaljava.lang.Exception