com.thoughtworks.xstream.mapper
Interface Mapper

All Known Subinterfaces:
ClassMapper
All Known Implementing Classes:
AbstractXmlFriendlyMapper, ArrayMapper, AttributeAliasingMapper, AttributeMapper, CachingMapper, CGLIBMapper, ClassAliasingMapper, DefaultImplementationsMapper, DefaultMapper, DynamicProxyMapper, EnumMapper, FieldAliasingMapper, ImmutableTypesMapper, ImplicitCollectionMapper, MapperWrapper, OuterClassMapper, XmlFriendlyMapper, XStream11XmlFriendlyMapper

public interface Mapper


Nested Class Summary
static interface Mapper.ImplicitCollectionMapping
           
static class Mapper.Null
          Place holder type used for null values.
 
Method Summary
 java.lang.String aliasForAttribute(java.lang.String attribute)
          Get the alias for an attrbute's name.
 java.lang.String attributeForAlias(java.lang.String alias)
          Get the attribut's name for an alias.
 java.lang.String attributeForClassDefiningField()
          Deprecated. since 1.2, use aliasForAttribute instead.
 java.lang.String attributeForEnumType()
          Deprecated. since 1.2, use aliasForAttribute instead.
 java.lang.String attributeForImplementationClass()
          Deprecated. since 1.2, use aliasForAttribute instead.
 java.lang.String attributeForReadResolveField()
          Deprecated. since 1.2, use aliasForAttribute instead.
 java.lang.Class defaultImplementationOf(java.lang.Class type)
           
 SingleValueConverter getConverterFromAttribute(java.lang.String name)
           
 SingleValueConverter getConverterFromItemType(java.lang.Class type)
           
 SingleValueConverter getConverterFromItemType(java.lang.String fieldName, java.lang.Class type)
           
 java.lang.String getFieldNameForItemTypeAndName(java.lang.Class definedIn, java.lang.Class itemType, java.lang.String itemFieldName)
          Get the name of the field that acts as the default collection for an object, or return null if there is none.
 Mapper.ImplicitCollectionMapping getImplicitCollectionDefForFieldName(java.lang.Class itemType, java.lang.String fieldName)
           
 java.lang.Class getItemTypeForItemFieldName(java.lang.Class definedIn, java.lang.String itemFieldName)
           
 boolean isImmutableValueType(java.lang.Class type)
          Whether this type is a simple immutable value (int, boolean, String, URL, etc.
 Mapper lookupMapperOfType(java.lang.Class type)
           
 java.lang.Class realClass(java.lang.String elementName)
          How a serialized class representation should be mapped back to a real class.
 java.lang.String realMember(java.lang.Class type, java.lang.String serialized)
          How a serialized member representation should be mapped back to a real member.
 java.lang.String serializedClass(java.lang.Class type)
          How a class name should be represented in its serialized form.
 java.lang.String serializedMember(java.lang.Class type, java.lang.String memberName)
          How a class member should be represented in its serialized form.
 boolean shouldSerializeMember(java.lang.Class definedIn, java.lang.String fieldName)
          Determine whether a specific member should be serialized.
 

Method Detail

serializedClass

java.lang.String serializedClass(java.lang.Class type)
How a class name should be represented in its serialized form.


realClass

java.lang.Class realClass(java.lang.String elementName)
How a serialized class representation should be mapped back to a real class.


serializedMember

java.lang.String serializedMember(java.lang.Class type,
                                  java.lang.String memberName)
How a class member should be represented in its serialized form.


realMember

java.lang.String realMember(java.lang.Class type,
                            java.lang.String serialized)
How a serialized member representation should be mapped back to a real member.


isImmutableValueType

boolean isImmutableValueType(java.lang.Class type)
Whether this type is a simple immutable value (int, boolean, String, URL, etc. Immutable types will be repeatedly written in the serialized stream, instead of using object references.


defaultImplementationOf

java.lang.Class defaultImplementationOf(java.lang.Class type)

attributeForImplementationClass

java.lang.String attributeForImplementationClass()
Deprecated. since 1.2, use aliasForAttribute instead.


attributeForClassDefiningField

java.lang.String attributeForClassDefiningField()
Deprecated. since 1.2, use aliasForAttribute instead.


attributeForReadResolveField

java.lang.String attributeForReadResolveField()
Deprecated. since 1.2, use aliasForAttribute instead.


attributeForEnumType

java.lang.String attributeForEnumType()
Deprecated. since 1.2, use aliasForAttribute instead.


aliasForAttribute

java.lang.String aliasForAttribute(java.lang.String attribute)
Get the alias for an attrbute's name.

Parameters:
attribute - the attribute
Returns:
the alias
Since:
1.2

attributeForAlias

java.lang.String attributeForAlias(java.lang.String alias)
Get the attribut's name for an alias.

Parameters:
alias - the alias
Returns:
the attribute's name
Since:
1.2

getFieldNameForItemTypeAndName

java.lang.String getFieldNameForItemTypeAndName(java.lang.Class definedIn,
                                                java.lang.Class itemType,
                                                java.lang.String itemFieldName)
Get the name of the field that acts as the default collection for an object, or return null if there is none.

Parameters:
definedIn - owning type
itemType - item type
itemFieldName - optional item element name

getItemTypeForItemFieldName

java.lang.Class getItemTypeForItemFieldName(java.lang.Class definedIn,
                                            java.lang.String itemFieldName)

getImplicitCollectionDefForFieldName

Mapper.ImplicitCollectionMapping getImplicitCollectionDefForFieldName(java.lang.Class itemType,
                                                                      java.lang.String fieldName)

shouldSerializeMember

boolean shouldSerializeMember(java.lang.Class definedIn,
                              java.lang.String fieldName)
Determine whether a specific member should be serialized.

Since:
1.1.3

getConverterFromItemType

SingleValueConverter getConverterFromItemType(java.lang.String fieldName,
                                              java.lang.Class type)

getConverterFromItemType

SingleValueConverter getConverterFromItemType(java.lang.Class type)

getConverterFromAttribute

SingleValueConverter getConverterFromAttribute(java.lang.String name)

lookupMapperOfType

Mapper lookupMapperOfType(java.lang.Class type)


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