java.time types.
These adapters mimic what ReflectiveTypeAdapterFactory would produce for the same
types. That is by no means a natural encoding, given that many of the types have standard ISO
representations. If Gson had added support for the types at the same time they appeared (in Java
8, released in 2014), it would surely have used those representations. Unfortunately, in the
intervening time, people have been using the reflective representations, and changing that would
potentially be incompatible. Meanwhile, depending on the details of private fields in JDK classes
is obviously fragile, and it also needs special --add-opens configuration with more
recent JDK versions. So here we freeze the representation that was current with JDK 21, in a way
that does not use reflection.
| Modifier and Type | Field and Description |
|---|---|
| private static final TypeAdapter | |
| private static final TypeAdapter | |
| pack-priv static final TypeAdapterFactory | |
| private static final TypeAdapter | |
| public static final TypeAdapter | |
| private static final TypeAdapter | |
| private static final TypeAdapter | |
| private static final TypeAdapter | |
| private static final TypeAdapter | |
| private static final TypeAdapter |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public TypeAdapterFactory | |
| private static TypeAdapter | |
| private static TypeAdapter | |
| private static TypeAdapter | |
| private static <T> T | |
| private static TypeAdapter |
| DURATION | back to summary |
|---|---|
| private static final TypeAdapter<Duration> DURATION | |
| INSTANT | back to summary |
|---|---|
| private static final TypeAdapter<Instant> INSTANT | |
| JAVA_TIME_FACTORY | back to summary |
|---|---|
| pack-priv static final TypeAdapterFactory JAVA_TIME_FACTORY | |
| LOCAL_DATE | back to summary |
|---|---|
| private static final TypeAdapter<LocalDate> LOCAL_DATE | |
| LOCAL_TIME | back to summary |
|---|---|
| public static final TypeAdapter<LocalTime> LOCAL_TIME | |
| MONTH_DAY | back to summary |
|---|---|
| private static final TypeAdapter<MonthDay> MONTH_DAY | |
| PERIOD | back to summary |
|---|---|
| private static final TypeAdapter<Period> PERIOD | |
| YEAR | back to summary |
|---|---|
| private static final TypeAdapter<Year> YEAR | |
| YEAR_MONTH | back to summary |
|---|---|
| private static final TypeAdapter<YearMonth> YEAR_MONTH | |
| ZONE_ID | back to summary |
|---|---|
| private static final TypeAdapter<ZoneId> ZONE_ID | |
| JavaTimeTypeAdapters | back to summary |
|---|---|
| pack-priv JavaTimeTypeAdapters() | |
| get | back to summary |
|---|---|
| public TypeAdapterFactory get() Implements com.
| |
| localDateTime | back to summary |
|---|---|
| private static TypeAdapter | |
| offsetDateTime | back to summary |
|---|---|
| private static TypeAdapter | |
| offsetTime | back to summary |
|---|---|
| private static TypeAdapter | |
| requireNonNullField | back to summary |
|---|---|
| private static <T> T requireNonNullField(T field, String fieldName, JsonReader reader) | |
| zonedDateTime | back to summary |
|---|---|
| private static TypeAdapter | |