public class TypeAdapters extends Object
TypeAdapter factories to use when converting java
objects to their appropriate JSON representation.| Constructor and Description |
|---|
TypeAdapters() |
| Modifier and Type | Method and Description |
|---|---|
static TypeAdapterFactory |
collectionFactory()
Return a
TypeAdapterFactory that contains the preferred JSON
de/serialization rules for Collections. |
static TypeAdapterFactory |
collectionFactory(boolean nullSafe)
Return a
TypeAdapterFactory that contains the preferred JSON
de/serialization rules for Collections. |
static TypeAdapter<Collection<?>> |
forCollection()
Deprecated.
The use of the type adapter is flawed because it doesn't
leverage
Gson's ability to dynamically override
adapters from different sources. The preferred approach is to
pass primitiveTypesFactory() to
GsonBuilder.registerTypeAdapterFactory(TypeAdapterFactory)
instead. |
static TypeAdapter<Object> |
forGenericObject()
Deprecated.
The use of the type adapter is flawed because it doesn't
leverage
Gson's ability to dynamically override
adapters from different sources. The preferred approach is to
pass primitiveTypesFactory() to
GsonBuilder.registerTypeAdapterFactory(TypeAdapterFactory)
instead. |
static TypeAdapter<Map<?,?>> |
forMap()
Deprecated.
The use of the type adapter is flawed because it doesn't
leverage
Gson's ability to dynamically override
adapters from different sources. The preferred approach is to
pass primitiveTypesFactory() to
GsonBuilder.registerTypeAdapterFactory(TypeAdapterFactory)
instead. |
static TypeAdapter<TObject> |
forTObject()
Deprecated.
The use of the type adapter is flawed because it doesn't
leverage
Gson's ability to dynamically override
adapters from different sources. The preferred approach is to
pass primitiveTypesFactory() to
GsonBuilder.registerTypeAdapterFactory(TypeAdapterFactory)
instead. |
static TypeAdapterFactory |
primitiveTypesFactory()
Return a
TypeAdapterFactory that contains the preferred JSON
de/serialization rules for primitive Concourse types. |
static TypeAdapterFactory |
primitiveTypesFactory(boolean nullSafe)
Return a
TypeAdapterFactory that contains the preferred JSON
de/serialization rules for primitive Concourse types. |
static TypeAdapterFactory |
tObjectFactory()
Return a
TypeAdapterFactory that contains the preferred JSON
de/serialization rules for TObjects. |
static TypeAdapterFactory |
tObjectFactory(boolean nullSafe)
Return a
TypeAdapterFactory that contains the preferred JSON
de/serialization rules for TObjects. |
public static TypeAdapterFactory collectionFactory()
TypeAdapterFactory that contains the preferred JSON
de/serialization rules for Collections.public static TypeAdapterFactory collectionFactory(boolean nullSafe)
TypeAdapterFactory that contains the preferred JSON
de/serialization rules for Collections.nullSafe - @Deprecated public static TypeAdapter<Collection<?>> forCollection()
Gson's ability to dynamically override
adapters from different sources. The preferred approach is to
pass primitiveTypesFactory() to
GsonBuilder.registerTypeAdapterFactory(TypeAdapterFactory)
instead.TypeAdapter that checks the size of a collection and
only converts them to a JSON array if necessary (i.e. a single item
collection will be converted to a single object in JSON).TypeAdapter to use for conversions@Deprecated public static TypeAdapter<Object> forGenericObject()
Gson's ability to dynamically override
adapters from different sources. The preferred approach is to
pass primitiveTypesFactory() to
GsonBuilder.registerTypeAdapterFactory(TypeAdapterFactory)
instead.TypeAdapter that converts generic objects to the
correct JSON representation so they can be converted back to java if
necessary.TypeAdapter to use for conversions@Deprecated public static TypeAdapter<Map<?,?>> forMap()
Gson's ability to dynamically override
adapters from different sources. The preferred approach is to
pass primitiveTypesFactory() to
GsonBuilder.registerTypeAdapterFactory(TypeAdapterFactory)
instead.TypeAdapter that converts built-in maps to
the correct JSON representation by deferring to the
java type adapter when serializing values.
This enables Concourse Server to correct convert the resultant JSON
string back to a Java structure when necessary.TypeAdapter to use for conversions@Deprecated public static TypeAdapter<TObject> forTObject()
Gson's ability to dynamically override
adapters from different sources. The preferred approach is to
pass primitiveTypesFactory() to
GsonBuilder.registerTypeAdapterFactory(TypeAdapterFactory)
instead.TypeAdapter that converts TObjects to
the correct JSON representation so they can be converted back to java if
necessary.TypeAdapter to use for conversionspublic static TypeAdapterFactory primitiveTypesFactory()
TypeAdapterFactory that contains the preferred JSON
de/serialization rules for primitive Concourse types.public static TypeAdapterFactory primitiveTypesFactory(boolean nullSafe)
TypeAdapterFactory that contains the preferred JSON
de/serialization rules for primitive Concourse types.nullSafe - public static TypeAdapterFactory tObjectFactory()
TypeAdapterFactory that contains the preferred JSON
de/serialization rules for TObjects.public static TypeAdapterFactory tObjectFactory(boolean nullSafe)
TypeAdapterFactory that contains the preferred JSON
de/serialization rules for TObjects.nullSafe -