public final class RuntimeTypeAdapterFactory<T>
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
<R> <any> |
create(Gson gson,
<any> type)
doc.
|
static <T> RuntimeTypeAdapterFactory<T> |
of(java.lang.Class<T> baseType)
Creates a new runtime type adapter for
baseType using "type" as
the type field name. |
static <T> RuntimeTypeAdapterFactory<T> |
of(java.lang.Class<T> baseType,
java.lang.String typeFieldName)
Creates a new runtime type adapter using for
baseType using typeFieldName as the type field name. |
static <T> RuntimeTypeAdapterFactory<T> |
of(java.lang.Class<T> baseType,
java.lang.String typeFieldName,
boolean maintainType)
Creates a new runtime type adapter using for
baseType using typeFieldName as the type field name. |
RuntimeTypeAdapterFactory<T> |
registerSubtype(java.lang.Class<? extends T> type)
Registers
type identified by its simple
name. |
RuntimeTypeAdapterFactory<T> |
registerSubtype(java.lang.Class<? extends T> type,
java.lang.String label)
Registers
type identified by label. |
public static <T> RuntimeTypeAdapterFactory<T> of(java.lang.Class<T> baseType, java.lang.String typeFieldName, boolean maintainType)
baseType using typeFieldName as the type field name. Type field names are case sensitive.
maintainType flag decide if the type will be stored in pojo or not.public static <T> RuntimeTypeAdapterFactory<T> of(java.lang.Class<T> baseType, java.lang.String typeFieldName)
baseType using typeFieldName as the type field name. Type field names are case sensitive.public static <T> RuntimeTypeAdapterFactory<T> of(java.lang.Class<T> baseType)
baseType using "type" as
the type field name.public RuntimeTypeAdapterFactory<T> registerSubtype(java.lang.Class<? extends T> type, java.lang.String label)
type identified by label. Labels are case
sensitive.java.lang.IllegalArgumentException - if either type or label
have already been registered on this type adapter.public RuntimeTypeAdapterFactory<T> registerSubtype(java.lang.Class<? extends T> type)
type identified by its simple
name. Labels are case sensitive.java.lang.IllegalArgumentException - if either type or its simple name
have already been registered on this type adapter.public <R> <any> create(Gson gson,
<any> type)