public class

AttributeMapper

extends MapperWrapper
java.lang.Object
   ↳ com.thoughtworks.xstream.mapper.MapperWrapper
     ↳ com.thoughtworks.xstream.mapper.AttributeMapper

Class Overview

Mapper that allows the usage of attributes for fields and corresponding types or specified arbitrary types. It is responsible for the lookup of the SingleValueConverter for item types and attribute names.

Summary

Public Constructors
AttributeMapper(Mapper wrapped)
This constructor is deprecated. since 1.3
AttributeMapper(Mapper wrapped, ConverterLookup converterLookup)
Public Methods
void addAttributeFor(Field field)
Tells this mapper to use an attribute for this field.
void addAttributeFor(Class type)
void addAttributeFor(Class definedIn, String fieldName)
Tells this mapper to use an attribute for this field.
void addAttributeFor(String fieldName, Class type)
SingleValueConverter getConverterFromAttribute(String attributeName)
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(Class type)
This method is deprecated. since 1.3, use getConverterFromItemType(String, Class, Class)
SingleValueConverter getConverterFromItemType(String fieldName, 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.
void setConverterLookup(ConverterLookup converterLookup)
This method is deprecated. since 1.3
boolean shouldLookForSingleValueConverter(String fieldName, Class type, Class definedIn)
[Expand]
Inherited Methods
From class com.thoughtworks.xstream.mapper.MapperWrapper
From class java.lang.Object
From interface com.thoughtworks.xstream.mapper.Mapper

Public Constructors

public AttributeMapper (Mapper wrapped)

This constructor is deprecated.
since 1.3

public AttributeMapper (Mapper wrapped, ConverterLookup converterLookup)

Public Methods

public void addAttributeFor (Field field)

Tells this mapper to use an attribute for this field.

Parameters
field the field itself

public void addAttributeFor (Class type)

public void addAttributeFor (Class definedIn, String fieldName)

Tells this mapper to use an attribute for this field.

Parameters
definedIn the declaring class of the field
fieldName the name of the field
Throws
IllegalArgumentException if the field does not exist

public void addAttributeFor (String fieldName, Class type)

public SingleValueConverter getConverterFromAttribute (String attributeName)

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 (Class type)

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

public SingleValueConverter getConverterFromItemType (String fieldName, 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 void setConverterLookup (ConverterLookup converterLookup)

This method is deprecated.
since 1.3

public boolean shouldLookForSingleValueConverter (String fieldName, Class type, Class definedIn)