public class

DefaultMapper

extends Object
implements Mapper
java.lang.Object
   ↳ com.thoughtworks.xstream.mapper.DefaultMapper

Class Overview

Default mapper implementation with 'vanilla' functionality. To build up the functionality required, wrap this mapper with other mapper implementations.

Summary

Public Constructors
DefaultMapper(ClassLoader classLoader)
DefaultMapper(ClassLoader classLoader, String classAttributeIdentifier)
This constructor is deprecated. since 1.2, use XStream.aliasAttrbute() for a different attribute name.
Public Methods
String aliasForAttribute(String attribute)
Get the alias for an attribute's name.
String aliasForAttribute(Class definedIn, String fieldName)
This method is deprecated. since 1.3, use combination of serializedMember(Class, String) and getConverterFromItemType(String, Class, Class)
String aliasForSystemAttribute(String attribute)
Get the alias for a system attribute's name.
String attributeForAlias(Class definedIn, String alias)
This method is deprecated. since 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.
String attributeForClassDefiningField()
This method is deprecated. since 1.2, use aliasForAttribute instead.
String attributeForEnumType()
This method is deprecated. since 1.2, use aliasForAttribute instead.
String attributeForImplementationClass()
This method is deprecated. since 1.2, use aliasForAttribute instead.
String attributeForReadResolveField()
This method is deprecated. since 1.2, use aliasForAttribute instead.
Class defaultImplementationOf(Class type)
SingleValueConverter getConverterFromAttribute(String name)
This method is deprecated. since 1.3, 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(Class definedIn, String attribute)
This method is deprecated. since 1.3.1, use getConverterFromAttribute(Class, String, Class)
SingleValueConverter getConverterFromItemType(String fieldName, Class type)
This method is deprecated. since 1.3, use getConverterFromItemType(String, Class, Class)
SingleValueConverter getConverterFromItemType(Class type)
This method is deprecated. since 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)
String lookupName(Class type)
Class lookupType(String elementName)
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.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.thoughtworks.xstream.mapper.Mapper

Public Constructors

public DefaultMapper (ClassLoader classLoader)

public DefaultMapper (ClassLoader classLoader, String classAttributeIdentifier)

This constructor is deprecated.
since 1.2, use XStream.aliasAttrbute() for a different attribute name.

Public Methods

public String aliasForAttribute (String attribute)

Get the alias for an attribute's name.

Parameters
attribute the attribute
Returns
  • the alias

public String aliasForAttribute (Class definedIn, String fieldName)

This method is deprecated.
since 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

public String aliasForSystemAttribute (String attribute)

Get the alias for a system attribute's name.

Parameters
attribute the system attribute
Returns
  • the alias

public String attributeForAlias (Class definedIn, String alias)

This method is deprecated.
since 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

public String attributeForAlias (String alias)

Get the attribute's name for an alias.

Parameters
alias the alias
Returns
  • the attribute's name

public String attributeForClassDefiningField ()

This method is deprecated.
since 1.2, use aliasForAttribute instead.

public String attributeForEnumType ()

This method is deprecated.
since 1.2, use aliasForAttribute instead.

public String attributeForImplementationClass ()

This method is deprecated.
since 1.2, use aliasForAttribute instead.

public String attributeForReadResolveField ()

This method is deprecated.
since 1.2, use aliasForAttribute instead.

public Class defaultImplementationOf (Class type)

public SingleValueConverter getConverterFromAttribute (String name)

This method is deprecated.
since 1.3, use getConverterFromAttribute(Class, String, Class)

public 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

public SingleValueConverter getConverterFromAttribute (Class definedIn, String attribute)

This method is deprecated.
since 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

public SingleValueConverter getConverterFromItemType (String fieldName, Class type)

This method is deprecated.
since 1.3, use getConverterFromItemType(String, Class, Class)

public SingleValueConverter getConverterFromItemType (Class type)

This method is deprecated.
since 1.3, use getConverterFromItemType(String, Class, Class)

public 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.

public 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

public Mapper.ImplicitCollectionMapping getImplicitCollectionDefForFieldName (Class itemType, String fieldName)

public Class getItemTypeForItemFieldName (Class definedIn, String itemFieldName)

public Converter getLocalConverter (Class definedIn, String fieldName)

public 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.

public Mapper lookupMapperOfType (Class type)

public String lookupName (Class type)

public Class lookupType (String elementName)

public Class realClass (String elementName)

How a serialized class representation should be mapped back to a real class.

public String realMember (Class type, String serialized)

How a serialized member representation should be mapped back to a real member.

public String serializedClass (Class type)

How a class name should be represented in its serialized form.

public String serializedMember (Class type, String memberName)

How a class member should be represented in its serialized form.

public boolean shouldSerializeMember (Class definedIn, String fieldName)

Determine whether a specific member should be serialized.