Package com.thoughtworks.xstream.mapper
Class ElementIgnoringMapper
- java.lang.Object
-
- com.thoughtworks.xstream.mapper.MapperWrapper
-
- com.thoughtworks.xstream.mapper.ElementIgnoringMapper
-
- All Implemented Interfaces:
Mapper
public class ElementIgnoringMapper extends MapperWrapper
Mapper that allows an field of a specific class to be omitted entirely.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.thoughtworks.xstream.mapper.Mapper
Mapper.ImplicitCollectionMapping, Mapper.Null
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set
fieldsToOmit
protected java.util.Set
unknownElementsToIgnore
-
Constructor Summary
Constructors Constructor Description ElementIgnoringMapper(Mapper wrapped)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addElementsToIgnore(java.util.regex.Pattern pattern)
boolean
isIgnoredElement(java.lang.String name)
Whether this name can be ignored.private java.lang.Object
key(java.lang.Class type, java.lang.String name)
void
omitField(java.lang.Class definedIn, java.lang.String fieldName)
boolean
shouldSerializeMember(java.lang.Class definedIn, java.lang.String fieldName)
Determine whether a specific member should be serialized.-
Methods inherited from class com.thoughtworks.xstream.mapper.MapperWrapper
aliasForAttribute, aliasForAttribute, aliasForSystemAttribute, attributeForAlias, attributeForAlias, defaultImplementationOf, getConverterFromAttribute, getConverterFromAttribute, getConverterFromAttribute, getConverterFromItemType, getConverterFromItemType, getConverterFromItemType, getFieldNameForItemTypeAndName, getImplicitCollectionDefForFieldName, getItemTypeForItemFieldName, getLocalConverter, isImmutableValueType, isReferenceable, lookupMapperOfType, realClass, realMember, serializedClass, serializedMember
-
-
-
-
Constructor Detail
-
ElementIgnoringMapper
public ElementIgnoringMapper(Mapper wrapped)
-
-
Method Detail
-
addElementsToIgnore
public void addElementsToIgnore(java.util.regex.Pattern pattern)
-
omitField
public void omitField(java.lang.Class definedIn, java.lang.String fieldName)
-
shouldSerializeMember
public boolean shouldSerializeMember(java.lang.Class definedIn, java.lang.String fieldName)
Description copied from interface:Mapper
Determine whether a specific member should be serialized.- Specified by:
shouldSerializeMember
in interfaceMapper
- Overrides:
shouldSerializeMember
in classMapperWrapper
-
isIgnoredElement
public boolean isIgnoredElement(java.lang.String name)
Description copied from interface:Mapper
Whether this name can be ignored.- Specified by:
isIgnoredElement
in interfaceMapper
- Overrides:
isIgnoredElement
in classMapperWrapper
-
key
private java.lang.Object key(java.lang.Class type, java.lang.String name)
-
-