PolymorphicAdapter

public final class PolymorphicAdapter<T extends Object> implements JsonDeserializer<T>, JsonSerializer<T>

Provides an adapter that stores the classname with the object being serialized. This allows for the object to be properly deserialized even when being serialized into a base class or interface.

Constructors

PolymorphicAdapter
Link copied to clipboard
PolymorphicAdapter<TPolymorphicAdapter()

Functions

deserialize
Link copied to clipboard
T deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
serialize
Link copied to clipboard
JsonElement serialize(T src, Type typeOfSrc, JsonSerializationContext context)