Marshaller@Deprecated public class MarshallerImpl extends java.lang.Object implements Marshaller
| Constructor and Description |
|---|
MarshallerImpl()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
static Marshaller |
getFallback()
Deprecated.
|
<T> T |
marshall(java.lang.Class<T> clazz,
JsonElement elem)
Deprecated.
Unpacks the provided JsonElement into a new object of type
clazz, making a best
effort to unpack all the fields it can. |
<T> T |
marshall(java.lang.Class<T> clazz,
JsonElement elem,
boolean failFast)
Deprecated.
|
<T> T |
marshall(java.lang.reflect.Type type,
JsonElement elem)
Deprecated.
EXPERIMENTAL.
|
<T> T |
marshallCarefully(java.lang.Class<T> clazz,
JsonElement elem)
Deprecated.
Unpacks the provided JsonElement in fail-fast mode.
|
<T> void |
register(java.lang.Class<T> clazz,
java.util.function.Function<java.lang.Object,T> marshaller)
Deprecated.
|
<A,B> void |
registerDeserializer(java.lang.Class<A> sourceClass,
java.lang.Class<B> targetClass,
DeserializerFunction<A,B> function)
Deprecated.
|
<T> void |
registerSerializer(java.lang.Class<T> clazz,
java.util.function.BiFunction<T,Marshaller,JsonElement> serializer)
Deprecated.
|
<T> void |
registerSerializer(java.lang.Class<T> clazz,
java.util.function.Function<T,JsonElement> serializer)
Deprecated.
|
<T> void |
registerTypeAdapter(java.lang.Class<T> clazz,
java.util.function.Function<JsonObject,T> adapter)
Deprecated.
|
<T> void |
registerTypeFactory(java.lang.Class<T> clazz,
java.util.function.Supplier<T> supplier)
Deprecated.
|
JsonElement |
serialize(java.lang.Object obj)
Deprecated.
Turns a java object into its json intermediate representation.
|
public static Marshaller getFallback()
public <T> void register(java.lang.Class<T> clazz,
java.util.function.Function<java.lang.Object,T> marshaller)
public <T> void registerTypeAdapter(java.lang.Class<T> clazz,
java.util.function.Function<JsonObject,T> adapter)
public <T> void registerSerializer(java.lang.Class<T> clazz,
java.util.function.Function<T,JsonElement> serializer)
public <T> void registerSerializer(java.lang.Class<T> clazz,
java.util.function.BiFunction<T,Marshaller,JsonElement> serializer)
public <T> void registerTypeFactory(java.lang.Class<T> clazz,
java.util.function.Supplier<T> supplier)
public <A,B> void registerDeserializer(java.lang.Class<A> sourceClass,
java.lang.Class<B> targetClass,
DeserializerFunction<A,B> function)
@Nullable
public <T> T marshall(java.lang.reflect.Type type,
JsonElement elem)
marshall in interface MarshallerT - The type to force-cast to at the endtype - The type to deserialize toelem - json intermediate representation of the data to be unpacked.public <T> T marshall(java.lang.Class<T> clazz,
JsonElement elem)
Marshallerclazz, 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 Marshaller.marshallCarefully(Class, JsonElement) to detect errors first,
and then calling this method as a fallback if an error is encountered.
marshall in interface MarshallerT - 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.public <T> T marshallCarefully(java.lang.Class<T> clazz,
JsonElement elem)
throws DeserializationException
MarshallermarshallCarefully in interface MarshallerT - 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.@Nullable
public <T> T marshall(java.lang.Class<T> clazz,
JsonElement elem,
boolean failFast)
throws DeserializationException
DeserializationExceptionpublic JsonElement serialize(java.lang.Object obj)
Marshallerserialize in interface Marshaller