com.thoughtworks.xstream.mapper
Class AttributeAliasingMapper

java.lang.Object
  extended bycom.thoughtworks.xstream.mapper.MapperWrapper
      extended bycom.thoughtworks.xstream.mapper.AttributeAliasingMapper
All Implemented Interfaces:
Mapper

public class AttributeAliasingMapper
extends MapperWrapper

Mapper that allows aliasing of attribute names.

Since:
1.2
Author:
Jörg Schaible, Guilherme Silveira

Nested Class Summary
 
Nested classes inherited from class com.thoughtworks.xstream.mapper.Mapper
Mapper.ImplicitCollectionMapping, Mapper.Null
 
Constructor Summary
AttributeAliasingMapper(Mapper wrapped)
           
 
Method Summary
 void addAliasFor(java.lang.Class definedIn, java.lang.String fieldName, java.lang.String alias)
          Adds an alias for a specific field.
 void addAliasFor(java.lang.String attributeName, java.lang.String alias)
           
 java.lang.String aliasForAttribute(java.lang.Class definedIn, java.lang.String fieldName)
          Returns an alias for a single field defined in an specific type.
 java.lang.String aliasForAttribute(java.lang.String attribute)
          Get the alias for an attrbute's name.
 java.lang.String attributeForAlias(java.lang.Class definedIn, java.lang.String alias)
          Returns the field name for an aliased attribute.
 java.lang.String attributeForAlias(java.lang.String alias)
          Get the attribut's name for an alias.
 
Methods inherited from class com.thoughtworks.xstream.mapper.MapperWrapper
attributeForClassDefiningField, attributeForEnumType, attributeForImplementationClass, attributeForReadResolveField, defaultImplementationOf, getConverterFromAttribute, getConverterFromAttribute, getConverterFromItemType, getConverterFromItemType, getConverterFromItemType, getFieldNameForItemTypeAndName, getImplicitCollectionDefForFieldName, getItemTypeForItemFieldName, isImmutableValueType, lookupMapperOfType, realClass, realMember, serializedClass, serializedMember, shouldSerializeMember
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeAliasingMapper

public AttributeAliasingMapper(Mapper wrapped)
Method Detail

addAliasFor

public void addAliasFor(java.lang.String attributeName,
                        java.lang.String alias)

aliasForAttribute

public java.lang.String aliasForAttribute(java.lang.String attribute)
Description copied from interface: Mapper
Get the alias for an attrbute's name.

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

attributeForAlias

public java.lang.String attributeForAlias(java.lang.String alias)
Description copied from interface: Mapper
Get the attribut's name for an alias.

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

aliasForAttribute

public java.lang.String aliasForAttribute(java.lang.Class definedIn,
                                          java.lang.String fieldName)
Description copied from interface: Mapper
Returns an alias for a single field defined in an specific type.

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

attributeForAlias

public java.lang.String attributeForAlias(java.lang.Class definedIn,
                                          java.lang.String alias)
Description copied from interface: Mapper
Returns the field name for an aliased attribute.

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

addAliasFor

public void addAliasFor(java.lang.Class definedIn,
                        java.lang.String fieldName,
                        java.lang.String alias)
Adds an alias for a specific field.

Parameters:
definedIn - the type where the field was defined
fieldName - the field name
alias - the alias to be used since 1.2.2


Joe Walnes, http://xstream.codehaus.org/