public final class Excluder extends java.lang.Object implements TypeAdapterFactory, java.lang.Cloneable
Since
and Until
, modifiers,
synthetic fields, anonymous and local classes, inner classes, and fields with
the Expose
annotation.
This class is a type adapter factory; types that are excluded will be adapted to null. It may delegate to another type adapter if only one direction is excluded.
Constructor and Description |
---|
Excluder() |
Modifier and Type | Method and Description |
---|---|
protected Excluder |
clone() |
<T> TypeAdapter<T> |
create(Gson gson,
TypeToken<T> type)
Returns a type adapter for
type , or null if this factory doesn't
support type . |
Excluder |
disableInnerClassSerialization() |
boolean |
excludeClass(java.lang.Class<?> clazz,
boolean serialize) |
boolean |
excludeField(java.lang.reflect.Field field,
boolean serialize) |
Excluder |
excludeFieldsWithoutExposeAnnotation() |
Excluder |
withExclusionStrategy(ExclusionStrategy exclusionStrategy,
boolean serialization,
boolean deserialization) |
Excluder |
withModifiers(int... modifiers) |
Excluder |
withVersion(double ignoreVersionsAfter) |
public static final Excluder DEFAULT
protected Excluder clone()
clone
in class java.lang.Object
public Excluder withVersion(double ignoreVersionsAfter)
public Excluder withModifiers(int... modifiers)
public Excluder disableInnerClassSerialization()
public Excluder excludeFieldsWithoutExposeAnnotation()
public Excluder withExclusionStrategy(ExclusionStrategy exclusionStrategy, boolean serialization, boolean deserialization)
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type)
TypeAdapterFactory
type
, or null if this factory doesn't
support type
.create
in interface TypeAdapterFactory
public boolean excludeField(java.lang.reflect.Field field, boolean serialize)
public boolean excludeClass(java.lang.Class<?> clazz, boolean serialize)