Package com.google.gson.internal
Class Excluder
- java.lang.Object
-
- com.google.gson.internal.Excluder
-
- All Implemented Interfaces:
TypeAdapterFactory,java.lang.Cloneable
public final class Excluder extends java.lang.Object implements TypeAdapterFactory, java.lang.Cloneable
This class selects which fields and types to omit. It is configurable, supporting version attributesSinceandUntil, modifiers, synthetic fields, anonymous and local classes, inner classes, and fields with theExposeannotation.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.
- Author:
- Joel Leitch, Jesse Wilson
-
-
Constructor Summary
Constructors Constructor Description Excluder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Excluderclone()<T> TypeAdapter<T>create(Gson gson, TypeToken<T> type)Returns a type adapter fortype, or null if this factory doesn't supporttype.ExcluderdisableInnerClassSerialization()booleanexcludeClass(java.lang.Class<?> clazz, boolean serialize)booleanexcludeField(java.lang.reflect.Field field, boolean serialize)ExcluderexcludeFieldsWithoutExposeAnnotation()ExcluderwithExclusionStrategy(ExclusionStrategy exclusionStrategy, boolean serialization, boolean deserialization)ExcluderwithModifiers(int... modifiers)ExcluderwithVersion(double ignoreVersionsAfter)
-
-
-
Field Detail
-
DEFAULT
public static final Excluder DEFAULT
-
-
Method Detail
-
clone
protected Excluder clone()
- Overrides:
clonein classjava.lang.Object
-
withVersion
public Excluder withVersion(double ignoreVersionsAfter)
-
withModifiers
public Excluder withModifiers(int... modifiers)
-
disableInnerClassSerialization
public Excluder disableInnerClassSerialization()
-
excludeFieldsWithoutExposeAnnotation
public Excluder excludeFieldsWithoutExposeAnnotation()
-
withExclusionStrategy
public Excluder withExclusionStrategy(ExclusionStrategy exclusionStrategy, boolean serialization, boolean deserialization)
-
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
-
excludeField
public boolean excludeField(java.lang.reflect.Field field, boolean serialize)
-
excludeClass
public boolean excludeClass(java.lang.Class<?> clazz, boolean serialize)
-
-