public class SimpleDateAdapter
extends javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,javax.xml.datatype.XMLGregorianCalendar>
Marshals the date time as YYY-MM-DD which is aligned with ISO 8601.
Notice the configured adapter in the model is the IsoDateAdapter wrapper class, but you can pass this
default implementation or your own in the constructor.
TypeAdaptersConfiguration| Constructor and Description |
|---|
SimpleDateAdapter()
Creates a date adapter with the default format
|
SimpleDateAdapter(java.text.SimpleDateFormat dateFormat)
Creates a time adapter with a specific given format that will be used for both the marshalling and unmarshalling
|
SimpleDateAdapter(javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,javax.xml.datatype.XMLGregorianCalendar> customAdapterImpl)
Creates a date 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 SimpleDateAdapter()
public SimpleDateAdapter(java.text.SimpleDateFormat dateFormat)
public SimpleDateAdapter(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