com.thoughtworks.xstream.mapper
Class AttributeMapper
java.lang.Object
com.thoughtworks.xstream.mapper.MapperWrapper
com.thoughtworks.xstream.mapper.AttributeMapper
- All Implemented Interfaces:
- Mapper
public class AttributeMapper
- extends MapperWrapper
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.
- Since:
- 1.2
- Author:
- Paul Hammant, Ian Cartwright, Jörg Schaible, Mauro Talevi, Guilherme Silveira
| Methods inherited from class com.thoughtworks.xstream.mapper.MapperWrapper |
aliasForAttribute, aliasForAttribute, attributeForAlias, attributeForAlias, attributeForClassDefiningField, attributeForEnumType, attributeForImplementationClass, attributeForReadResolveField, defaultImplementationOf, 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 |
AttributeMapper
public AttributeMapper(Mapper wrapped)
AttributeMapper
public AttributeMapper(Mapper wrapped,
ConverterLookup converterLookup)
setConverterLookup
public void setConverterLookup(ConverterLookup converterLookup)
addAttributeFor
public void addAttributeFor(String fieldName,
Class type)
addAttributeFor
public void addAttributeFor(Class type)
getLocalConverterFromItemType
protected SingleValueConverter getLocalConverterFromItemType(Class type)
getConverterFromItemType
public SingleValueConverter getConverterFromItemType(String fieldName,
Class type)
- Specified by:
getConverterFromItemType in interface Mapper- Overrides:
getConverterFromItemType in class MapperWrapper
getConverterFromItemType
public SingleValueConverter getConverterFromItemType(String fieldName,
Class type,
Class definedIn)
- Description copied from interface:
Mapper
- Returns a single value converter to be used in a specific field.
- Specified by:
getConverterFromItemType in interface Mapper- Overrides:
getConverterFromItemType in class MapperWrapper
- Parameters:
fieldName - the field nametype - the field typedefinedIn - 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
getConverterFromItemType
public SingleValueConverter getConverterFromItemType(Class type)
- Specified by:
getConverterFromItemType in interface Mapper- Overrides:
getConverterFromItemType in class MapperWrapper
getConverterFromAttribute
public SingleValueConverter getConverterFromAttribute(String attributeName)
- Specified by:
getConverterFromAttribute in interface Mapper- Overrides:
getConverterFromAttribute in class MapperWrapper
getConverterFromAttribute
public SingleValueConverter getConverterFromAttribute(Class type,
String attribute)
- Description copied from interface:
Mapper
- Returns which converter to use for an specific attribute in a type.
- Specified by:
getConverterFromAttribute in interface Mapper- Overrides:
getConverterFromAttribute in class MapperWrapper
- Parameters:
type - the field typeattribute - the attribute name
since 1.2.2
addAttributeFor
public void addAttributeFor(Field field)
- Tells this mapper to use an attribute for this field.
- Parameters:
field - the field itself
since 1.2.2
Copyright © 2004-2007 XStream. All Rights Reserved.