- Direct Known Subclasses:
LongTimestampAdapter
,ShortDateAdapter
public abstract class AbstractDateAdapter
extends javax.xml.bind.annotation.adapters.XmlAdapter<String,Date>
Base for date adapters. Uses a thread local to keep thread safe with the
thread unsafe DateFormat objects.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract DateFormat
Create the correct date format object for the type of dates expected.Convert the given date into the expected date format.Parse the string into a Date object.
-
Constructor Details
-
AbstractDateAdapter
protected AbstractDateAdapter()Empty constructor.
-
-
Method Details
-
createFormatter
Create the correct date format object for the type of dates expected.- Returns:
- The DateFormat object.
-
unmarshal
Parse the string into a Date object.- Specified by:
unmarshal
in classjavax.xml.bind.annotation.adapters.XmlAdapter<String,
Date> - Parameters:
v
- The string to parse.- Returns:
- A
Date
object for the string, or null ifv
is null. - Throws:
ParseException
- if the string cannot be parsed.
-
marshal
Convert the given date into the expected date format.
-