public interface Marshaller
| Modifier and Type | Method and Description |
|---|---|
<E> E |
marshall(java.lang.Class<E> clazz,
JsonElement elem)
Unpacks the provided JsonElement into a new object of type
clazz, making a best
effort to unpack all the fields it can. |
<E> E |
marshall(java.lang.reflect.Type type,
JsonElement elem)
Unpacks the provided JsonElement into an object of the provided Type, and force-casts it to
E.
|
<E> E |
marshallCarefully(java.lang.Class<E> clazz,
JsonElement elem)
Unpacks the provided JsonElement in fail-fast mode.
|
JsonElement |
serialize(java.lang.Object obj)
Turns a java object into its json intermediate representation.
|
JsonElement serialize(java.lang.Object obj)
<E> E marshall(java.lang.Class<E> clazz,
JsonElement elem)
clazz, making a best
effort to unpack all the fields it can. Any fields that cannot be unpacked will be left in
the state the initializer and no-arg constructor leaves them in.
Note: Consider using marshallCarefully(Class, JsonElement) to detect errors first,
and then calling this method as a fallback if an error is encountered.
E - The type of the object to create and deserializeclazz - The class of the object to create and deserializeelem - json intermediate representation of the data to be unpacked.<E> E marshall(java.lang.reflect.Type type,
JsonElement elem)
E - The type to force-cast to at the endtype - The type to deserialize toelem - json intermediate representation of the data to be unpacked.<E> E marshallCarefully(java.lang.Class<E> clazz,
JsonElement elem)
throws DeserializationException
E - The type of the object to create and deserializeclazz - The class of the object to create and deserializeelem - json intermediate representation of the data to be unpacked.DeserializationException - if any problems are encountered unpacking the data.