Package org.apache.fulcrum.json.gson
Class DateTypeAdapter
- java.lang.Object
-
- com.google.gson.TypeAdapter<Date>
-
- org.apache.fulcrum.json.gson.DateTypeAdapter
-
public final class DateTypeAdapter extends com.google.gson.TypeAdapter<Date>
Adapter for Date. Although this class appears stateless, it is not. DateFormat captures its time zone and locale when it is created, which gives this class state. DateFormat isn't thread safe either, so this class has to synchronize its read and write methods.
-
-
Field Summary
Fields Modifier and Type Field Description static com.google.gson.TypeAdapterFactory
FACTORY
-
Constructor Summary
Constructors Constructor Description DateTypeAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DateFormat
getCustomDateFormat()
Date
read(com.google.gson.stream.JsonReader in)
void
setCustomDateFormat(DateFormat df)
void
write(com.google.gson.stream.JsonWriter out, Date value)
-
-
-
Field Detail
-
FACTORY
public static final com.google.gson.TypeAdapterFactory FACTORY
-
-
Constructor Detail
-
DateTypeAdapter
public DateTypeAdapter()
-
-
Method Detail
-
setCustomDateFormat
public void setCustomDateFormat(DateFormat df)
-
getCustomDateFormat
public DateFormat getCustomDateFormat()
-
read
public Date read(com.google.gson.stream.JsonReader in) throws IOException
- Specified by:
read
in classcom.google.gson.TypeAdapter<Date>
- Throws:
IOException
-
write
public void write(com.google.gson.stream.JsonWriter out, Date value) throws IOException
- Specified by:
write
in classcom.google.gson.TypeAdapter<Date>
- Throws:
IOException
-
-