- java.lang.Object
-
- com.google.gson.internal.bind.ReflectiveTypeAdapterFactory
-
- All Implemented Interfaces:
TypeAdapterFactory
public final class ReflectiveTypeAdapterFactory extends java.lang.Object implements TypeAdapterFactory
Type adapter that reflects over the fields and methods of a class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReflectiveTypeAdapterFactory.Adapter<T>(package private) static classReflectiveTypeAdapterFactory.BoundField
-
Field Summary
Fields Modifier and Type Field Description private ReflectionAccessoraccessorprivate ConstructorConstructorconstructorConstructorprivate Excluderexcluderprivate FieldNamingStrategyfieldNamingPolicyprivate JsonAdapterAnnotationTypeAdapterFactoryjsonAdapterFactory
-
Constructor Summary
Constructors Constructor Description ReflectiveTypeAdapterFactory(ConstructorConstructor constructorConstructor, FieldNamingStrategy fieldNamingPolicy, Excluder excluder, JsonAdapterAnnotationTypeAdapterFactory jsonAdapterFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TypeAdapter<T>create(Gson gson, TypeToken<T> type)Returns a type adapter fortype, or null if this factory doesn't supporttype.private ReflectiveTypeAdapterFactory.BoundFieldcreateBoundField(Gson context, java.lang.reflect.Field field, java.lang.String name, TypeToken<?> fieldType, boolean serialize, boolean deserialize)booleanexcludeField(java.lang.reflect.Field f, boolean serialize)(package private) static booleanexcludeField(java.lang.reflect.Field f, boolean serialize, Excluder excluder)private java.util.Map<java.lang.String,ReflectiveTypeAdapterFactory.BoundField>getBoundFields(Gson context, TypeToken<?> type, java.lang.Class<?> raw)private java.util.List<java.lang.String>getFieldNames(java.lang.reflect.Field f)first element holds the default name
-
-
-
Field Detail
-
constructorConstructor
private final ConstructorConstructor constructorConstructor
-
fieldNamingPolicy
private final FieldNamingStrategy fieldNamingPolicy
-
excluder
private final Excluder excluder
-
jsonAdapterFactory
private final JsonAdapterAnnotationTypeAdapterFactory jsonAdapterFactory
-
accessor
private final ReflectionAccessor accessor
-
-
Constructor Detail
-
ReflectiveTypeAdapterFactory
public ReflectiveTypeAdapterFactory(ConstructorConstructor constructorConstructor, FieldNamingStrategy fieldNamingPolicy, Excluder excluder, JsonAdapterAnnotationTypeAdapterFactory jsonAdapterFactory)
-
-
Method Detail
-
excludeField
public boolean excludeField(java.lang.reflect.Field f, boolean serialize)
-
excludeField
static boolean excludeField(java.lang.reflect.Field f, boolean serialize, Excluder excluder)
-
getFieldNames
private java.util.List<java.lang.String> getFieldNames(java.lang.reflect.Field f)
first element holds the default name
-
create
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type)
Description copied from interface:TypeAdapterFactoryReturns a type adapter fortype, or null if this factory doesn't supporttype.- Specified by:
createin interfaceTypeAdapterFactory
-
createBoundField
private ReflectiveTypeAdapterFactory.BoundField createBoundField(Gson context, java.lang.reflect.Field field, java.lang.String name, TypeToken<?> fieldType, boolean serialize, boolean deserialize)
-
getBoundFields
private java.util.Map<java.lang.String,ReflectiveTypeAdapterFactory.BoundField> getBoundFields(Gson context, TypeToken<?> type, java.lang.Class<?> raw)
-
-