Class ZuluOffsetDateTimeAdapter
- java.lang.Object
-
- jakarta.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,java.time.OffsetDateTime>
-
- com.prowidesoftware.swift.model.mx.adapters.ZuluOffsetDateTimeAdapter
-
public class ZuluOffsetDateTimeAdapter extends jakarta.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,java.time.OffsetDateTime>Zulu OffsetDateTime adapter for date time elements.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
IsoDateTimeAdapterwrapper class, but you can pass this default implementation or your own in the constructor.- Since:
- 9.4,5
- See Also:
TypeAdaptersConfiguration
-
-
Constructor Summary
Constructors Constructor Description ZuluOffsetDateTimeAdapter()Creates a date time adapter with the default format.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringmarshal(java.time.OffsetDateTime offsetDateTime)Formats an OffsetDateTime to a string using the configured format.java.lang.StringtoString()java.time.OffsetDateTimeunmarshal(java.lang.String value)Parses a date-time string to create an OffsetDateTime object.
-
-
-
Method Detail
-
unmarshal
public java.time.OffsetDateTime unmarshal(java.lang.String value)
Parses a date-time string to create an OffsetDateTime object.- Specified by:
unmarshalin classjakarta.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,java.time.OffsetDateTime>- Parameters:
value- the XML date time value to convert- Returns:
- created OffsetDateTime object or null if it cannot be parsed
-
marshal
public java.lang.String marshal(java.time.OffsetDateTime offsetDateTime) throws java.lang.ExceptionFormats an OffsetDateTime to a string using the configured format.- Specified by:
marshalin classjakarta.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,java.time.OffsetDateTime>- Parameters:
offsetDateTime- the model OffsetDateTime to marshal- Returns:
- formatted content for the XML
- Throws:
java.lang.Exception
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-