public final class DateTypeAdapter extends TypeAdapter<java.util.Date>
Modifier and Type | Field and Description |
---|---|
private java.text.DateFormat |
enUsFormat |
static TypeAdapterFactory |
FACTORY |
private java.text.DateFormat |
iso8601Format |
private java.text.DateFormat |
localFormat |
Constructor and Description |
---|
DateTypeAdapter() |
Modifier and Type | Method and Description |
---|---|
private static java.text.DateFormat |
buildIso8601Format() |
private java.util.Date |
deserializeToDate(java.lang.String json) |
java.util.Date |
read(JsonReader in)
Reads one JSON value (an array, object, string, number, boolean or null)
and converts it to a Java object.
|
void |
write(JsonWriter out,
java.util.Date value)
Writes one JSON value (an array, object, string, number, boolean or null)
for
value . |
fromJson, fromJson, fromJsonTree, nullSafe, toJson, toJson, toJsonTree
public static final TypeAdapterFactory FACTORY
private final java.text.DateFormat enUsFormat
private final java.text.DateFormat localFormat
private final java.text.DateFormat iso8601Format
private static java.text.DateFormat buildIso8601Format()
public java.util.Date read(JsonReader in) throws java.io.IOException
TypeAdapter
read
in class TypeAdapter<java.util.Date>
java.io.IOException
private java.util.Date deserializeToDate(java.lang.String json)
public void write(JsonWriter out, java.util.Date value) throws java.io.IOException
TypeAdapter
value
.write
in class TypeAdapter<java.util.Date>
value
- the Java object to write. May be null.java.io.IOException