public interface GsonSerializable
Classes which implement this interface should also implement a static "deserialize" method,
accepting JsonElement as the only parameter.
| Modifier and Type | Method and Description |
|---|---|
static <T extends GsonSerializable> |
deserialize(Class<T> clazz,
com.google.gson.JsonElement element)
Deserializes a JsonElement to a GsonSerializable object.
|
static GsonSerializable |
deserializeRaw(Class<?> clazz,
com.google.gson.JsonElement element)
Deserializes a JsonElement to a GsonSerializable object.
|
static Method |
getDeserializeMethod(Class<?> clazz)
Gets the deserialization method for a given class.
|
com.google.gson.JsonElement |
serialize()
Serializes the object to JSON
|
@Nonnull static <T extends GsonSerializable> T deserialize(@Nonnull Class<T> clazz, @Nonnull com.google.gson.JsonElement element)
T - the GsonSerializable typeclazz - the GsonSerializable classelement - the json element to deserializeIllegalStateException - if the clazz does not have a deserialization method@Nonnull static GsonSerializable deserializeRaw(@Nonnull Class<?> clazz, @Nonnull com.google.gson.JsonElement element)
clazz - the GsonSerializable classelement - the json element to deserializeIllegalStateException - if the clazz does not have a deserialization method@Nullable static Method getDeserializeMethod(@Nonnull Class<?> clazz)
clazz - the class@Nonnull com.google.gson.JsonElement serialize()
Copyright © 2022. All rights reserved.