com.thoughtworks.xstream.mapper
Interface Mapper

All Known Implementing Classes:
AbstractAttributeAliasingMapper, AbstractXmlFriendlyMapper, AnnotationMapper, ArrayMapper, AttributeAliasingMapper, AttributeMapper, CachingMapper, CGLIBMapper, ClassAliasingMapper, DefaultImplementationsMapper, DefaultMapper, DynamicProxyMapper, EnumMapper, FieldAliasingMapper, ImmutableTypesMapper, ImplicitCollectionMapper, LocalConversionMapper, MapperWrapper, OuterClassMapper, PackageAliasingMapper, SystemAttributeAliasingMapper, 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
 String aliasForAttribute(Class definedIn, String fieldName)
          Deprecated. As of 1.3, use combination of serializedMember(Class, String) and getConverterFromItemType(String, Class, Class)
 String aliasForAttribute(String attribute)
          Get the alias for an attribute's name.
 String aliasForSystemAttribute(String attribute)
          Get the alias for a system attribute's name.
 String attributeForAlias(Class definedIn, String alias)
          Deprecated. As of 1.3, use combination of realMember(Class, String) and getConverterFromItemType(String, Class, Class)
 String attributeForAlias(String alias)
          Get the attribute's name for an alias.
 Class defaultImplementationOf(Class type)
           
 SingleValueConverter getConverterFromAttribute(Class definedIn, String attribute)
          Deprecated. As of 1.3.1, use getConverterFromAttribute(Class, String, Class)
 SingleValueConverter getConverterFromAttribute(Class definedIn, String attribute, Class type)
          Returns which converter to use for an specific attribute in a type.
 SingleValueConverter getConverterFromAttribute(String name)
          Deprecated. As of 1.3, use getConverterFromAttribute(Class, String, Class)
 SingleValueConverter getConverterFromItemType(Class type)
          Deprecated. As of 1.3, use getConverterFromItemType(String, Class, Class)
 SingleValueConverter getConverterFromItemType(String fieldName, Class type)
          Deprecated. As of 1.3, use getConverterFromItemType(String, Class, Class)
 SingleValueConverter getConverterFromItemType(String fieldName, Class type, Class definedIn)
          Returns a single value converter to be used in a specific field.
 String getFieldNameForItemTypeAndName(Class definedIn, Class itemType, 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(Class itemType, String fieldName)
           
 Class getItemTypeForItemFieldName(Class definedIn, String itemFieldName)
           
 Converter getLocalConverter(Class definedIn, String fieldName)
           
 boolean isImmutableValueType(Class type)
          Whether this type is a simple immutable value (int, boolean, String, URL, etc.
 Mapper lookupMapperOfType(Class type)
           
 Class realClass(String elementName)
          How a serialized class representation should be mapped back to a real class.
 String realMember(Class type, String serialized)
          How a serialized member representation should be mapped back to a real member.
 String serializedClass(Class type)
          How a class name should be represented in its serialized form.
 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.
 

Method Detail

serializedClass

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


realClass

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


serializedMember

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


realMember

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


isImmutableValueType

boolean isImmutableValueType(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

Class defaultImplementationOf(Class type)

aliasForAttribute

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

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

attributeForAlias

String attributeForAlias(String alias)
Get the attribute's name for an alias.

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

aliasForSystemAttribute

String aliasForSystemAttribute(String attribute)
Get the alias for a system attribute's name.

Parameters:
attribute - the system attribute
Returns:
the alias
Since:
1.3.1

getFieldNameForItemTypeAndName

String getFieldNameForItemTypeAndName(Class definedIn,
                                      Class itemType,
                                      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

Class getItemTypeForItemFieldName(Class definedIn,
                                  String itemFieldName)

getImplicitCollectionDefForFieldName

Mapper.ImplicitCollectionMapping getImplicitCollectionDefForFieldName(Class itemType,
                                                                      String fieldName)

shouldSerializeMember

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

Since:
1.1.3

getConverterFromItemType

SingleValueConverter getConverterFromItemType(String fieldName,
                                              Class type)
Deprecated. As of 1.3, use getConverterFromItemType(String, Class, Class)


getConverterFromItemType

SingleValueConverter getConverterFromItemType(Class type)
Deprecated. As of 1.3, use getConverterFromItemType(String, Class, Class)


getConverterFromAttribute

SingleValueConverter getConverterFromAttribute(String name)
Deprecated. As of 1.3, use getConverterFromAttribute(Class, String, Class)


getLocalConverter

Converter getLocalConverter(Class definedIn,
                            String fieldName)

lookupMapperOfType

Mapper lookupMapperOfType(Class type)

getConverterFromItemType

SingleValueConverter getConverterFromItemType(String fieldName,
                                              Class type,
                                              Class definedIn)
Returns a single value converter to be used in a specific field.

Parameters:
fieldName - the field name
type - the field type
definedIn - the type which defines this field
Returns:
a SingleValueConverter or null if there no such converter should be used for this field.
Since:
1.2.2

aliasForAttribute

String aliasForAttribute(Class definedIn,
                         String fieldName)
Deprecated. As of 1.3, use combination of serializedMember(Class, String) and getConverterFromItemType(String, Class, Class)

Returns an alias for a single field defined in an specific type.

Parameters:
definedIn - the type where the field was defined
fieldName - the field name
Returns:
the alias for this field or its own name if no alias was defined
Since:
1.2.2

attributeForAlias

String attributeForAlias(Class definedIn,
                         String alias)
Deprecated. As of 1.3, use combination of realMember(Class, String) and getConverterFromItemType(String, Class, Class)

Returns the field name for an aliased attribute.

Parameters:
definedIn - the type where the field was defined
alias - the alias
Returns:
the original attribute name
Since:
1.2.2

getConverterFromAttribute

SingleValueConverter getConverterFromAttribute(Class definedIn,
                                               String attribute)
Deprecated. As of 1.3.1, use getConverterFromAttribute(Class, String, Class)

Returns which converter to use for an specific attribute in a type.

Parameters:
definedIn - the field's parent
attribute - the attribute name

getConverterFromAttribute

SingleValueConverter getConverterFromAttribute(Class definedIn,
                                               String attribute,
                                               Class type)
Returns which converter to use for an specific attribute in a type.

Parameters:
definedIn - the field's parent
attribute - the attribute name
type - the type the converter should create
Since:
1.3.1


Copyright © 2004-2014 XStream. All Rights Reserved.