Class AttributeMapper
java.lang.Object
com.thoughtworks.xstream.mapper.MapperWrapper
com.thoughtworks.xstream.mapper.AttributeMapper
- All Implemented Interfaces:
Mapper
- Direct Known Subclasses:
UseAttributeForEnumMapper
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface Mapper
Mapper.ImplicitCollectionMapping, Mapper.Null -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ConverterLookupprivate final Mapprivate final Setprivate ReflectionProviderprivate final Set -
Constructor Summary
ConstructorsConstructorDescriptionAttributeMapper(Mapper wrapped) Deprecated.As of 1.3AttributeMapper(Mapper wrapped, ConverterLookup converterLookup, ReflectionProvider refProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttributeFor(Class type) voidaddAttributeFor(Class definedIn, String fieldName) Tells this mapper to use an attribute for this field.voidaddAttributeFor(Field field) Tells this mapper to use an attribute for this field.voidaddAttributeFor(String fieldName, Class type) getConverterFromAttribute(Class definedIn, String attribute) Deprecated.As of 1.3.1, usegetConverterFromAttribute(Class, String, Class)getConverterFromAttribute(Class definedIn, String attribute, Class type) Returns which converter to use for an specific attribute in a type.getConverterFromAttribute(String attributeName) Deprecated.As of 1.3, usegetConverterFromAttribute(Class, String, Class)Deprecated.As of 1.3, usegetConverterFromItemType(String, Class, Class)getConverterFromItemType(String fieldName, Class type) Deprecated.As of 1.3, usegetConverterFromItemType(String, Class, Class)getConverterFromItemType(String fieldName, Class type, Class definedIn) Returns a single value converter to be used in a specific field.private SingleValueConvertervoidsetConverterLookup(ConverterLookup converterLookup) Deprecated.As of 1.3booleanshouldLookForSingleValueConverter(String fieldName, Class type, Class definedIn) Methods inherited from class MapperWrapper
aliasForAttribute, aliasForAttribute, aliasForSystemAttribute, attributeForAlias, attributeForAlias, defaultImplementationOf, getFieldNameForItemTypeAndName, getImplicitCollectionDefForFieldName, getItemTypeForItemFieldName, getLocalConverter, isIgnoredElement, isImmutableValueType, isReferenceable, lookupMapperOfType, realClass, realMember, serializedClass, serializedMember, shouldSerializeMember
-
Field Details
-
fieldNameToTypeMap
-
typeSet
-
converterLookup
-
reflectionProvider
-
fieldToUseAsAttribute
-
-
Constructor Details
-
AttributeMapper
Deprecated.As of 1.3 -
AttributeMapper
public AttributeMapper(Mapper wrapped, ConverterLookup converterLookup, ReflectionProvider refProvider)
-
-
Method Details
-
setConverterLookup
Deprecated.As of 1.3 -
addAttributeFor
-
addAttributeFor
-
getLocalConverterFromItemType
-
getConverterFromItemType
Deprecated.As of 1.3, usegetConverterFromItemType(String, Class, Class)- Specified by:
getConverterFromItemTypein interfaceMapper- Overrides:
getConverterFromItemTypein classMapperWrapper
-
getConverterFromItemType
Description copied from interface:MapperReturns a single value converter to be used in a specific field.- Specified by:
getConverterFromItemTypein interfaceMapper- Overrides:
getConverterFromItemTypein classMapperWrapper- 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.
-
shouldLookForSingleValueConverter
-
getConverterFromItemType
Deprecated.As of 1.3, usegetConverterFromItemType(String, Class, Class)- Specified by:
getConverterFromItemTypein interfaceMapper- Overrides:
getConverterFromItemTypein classMapperWrapper
-
getConverterFromAttribute
Deprecated.As of 1.3, usegetConverterFromAttribute(Class, String, Class)- Specified by:
getConverterFromAttributein interfaceMapper- Overrides:
getConverterFromAttributein classMapperWrapper
-
getConverterFromAttribute
Deprecated.As of 1.3.1, usegetConverterFromAttribute(Class, String, Class)Description copied from interface:MapperReturns which converter to use for an specific attribute in a type.- Specified by:
getConverterFromAttributein interfaceMapper- Overrides:
getConverterFromAttributein classMapperWrapper- Parameters:
definedIn- the field's parentattribute- the attribute name
-
getConverterFromAttribute
public SingleValueConverter getConverterFromAttribute(Class definedIn, String attribute, Class type) Description copied from interface:MapperReturns which converter to use for an specific attribute in a type.- Specified by:
getConverterFromAttributein interfaceMapper- Overrides:
getConverterFromAttributein classMapperWrapper- Parameters:
definedIn- the field's parentattribute- the attribute nametype- the type the converter should create
-
addAttributeFor
Tells this mapper to use an attribute for this field.- Parameters:
field- the field itself- Since:
- 1.2.2
-
addAttributeFor
-