com.thoughtworks.xstream.mapper
Class FieldAliasingMapper

java.lang.Object
  extended by com.thoughtworks.xstream.mapper.MapperWrapper
      extended by com.thoughtworks.xstream.mapper.FieldAliasingMapper
All Implemented Interfaces:
Mapper

public class FieldAliasingMapper
extends MapperWrapper

Mapper that allows a field of a specific class to be replaced with a shorter alias, or omitted entirely.

Author:
Joe Walnes

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.thoughtworks.xstream.mapper.Mapper
Mapper.ImplicitCollectionMapping, Mapper.Null
 
Field Summary
protected  Map aliasToFieldMap
           
protected  Set fieldsToOmit
           
protected  Map fieldToAliasMap
           
 
Constructor Summary
FieldAliasingMapper(Mapper wrapped)
           
 
Method Summary
 void addFieldAlias(String alias, Class type, String fieldName)
           
 void omitField(Class definedIn, String fieldName)
           
 String realMember(Class type, String serialized)
          How a serialized member representation should be mapped back to a real member.
 String serializedMember(Class type, String memberName)
          How a class member should be represented in its serialized form.
 boolean shouldSerializeMember(Class definedIn, 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, lookupMapperOfType, realClass, serializedClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fieldToAliasMap

protected final Map fieldToAliasMap

aliasToFieldMap

protected final Map aliasToFieldMap

fieldsToOmit

protected final Set fieldsToOmit
Constructor Detail

FieldAliasingMapper

public FieldAliasingMapper(Mapper wrapped)
Method Detail

addFieldAlias

public void addFieldAlias(String alias,
                          Class type,
                          String fieldName)

serializedMember

public String serializedMember(Class type,
                               String memberName)
Description copied from interface: Mapper
How a class member should be represented in its serialized form.

Specified by:
serializedMember in interface Mapper
Overrides:
serializedMember in class MapperWrapper

realMember

public String realMember(Class type,
                         String serialized)
Description copied from interface: Mapper
How a serialized member representation should be mapped back to a real member.

Specified by:
realMember in interface Mapper
Overrides:
realMember in class MapperWrapper

shouldSerializeMember

public boolean shouldSerializeMember(Class definedIn,
                                     String fieldName)
Description copied from interface: Mapper
Determine whether a specific member should be serialized.

Specified by:
shouldSerializeMember in interface Mapper
Overrides:
shouldSerializeMember in class MapperWrapper

omitField

public void omitField(Class definedIn,
                      String fieldName)


Copyright © 2004-2014 XStream. All Rights Reserved.