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 TypeAdapter<Collection<?>> |
forCollection()
Return the
TypeAdapter that checks the size of a collection and
only converts them to a JSON array if necessary (i.e. |
static TypeAdapter<Object> |
forGenericObject()
Return the
TypeAdapter that converts generic objects to the
correct JSON representation so they can be converted back to java if
necessary. |
static TypeAdapter<Map<?,?>> |
forMap()
Return the
TypeAdapter that converts built-in maps to
the correct JSON representation by deferring to the
java type adapter when serializing values. |
static TypeAdapter<TObject> |
forTObject()
Return the
TypeAdapter that converts TObjects to
the correct JSON representation so they can be converted back to java if
necessary. |
public static TypeAdapter<Collection<?>> forCollection()
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 conversionspublic static TypeAdapter<Object> forGenericObject()
TypeAdapter that converts generic objects to the
correct JSON representation so they can be converted back to java if
necessary.TypeAdapter to use for conversionspublic static TypeAdapter<TObject> forTObject()
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 TypeAdapter<Map<?,?>> forMap()
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