Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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

Nested Class Summary

Nested classes/interfaces inherited from interface com.thoughtworks.xstream.mapper.Mapper
`Mapper.ImplicitCollectionMapping, Mapper.Null`

Constructor Summary
`AttributeMapper(Mapper wrapped)` Deprecated. since 1.3
`AttributeMapper(Mapper wrapped, ConverterLookup converterLookup)`

Method Summary
`void` | `addAttributeFor(Class type)`
`void` | `addAttributeFor(Class definedIn, String fieldName)` Tells this mapper to use an attribute for this field.
`void` | `addAttributeFor(Field field)` Tells this mapper to use an attribute for this field.
`void` | `addAttributeFor(String fieldName, Class type)`
`SingleValueConverter` | `getConverterFromAttribute(Class definedIn, String attribute)` Deprecated. since 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 attributeName)` Deprecated. since 1.3, use `getConverterFromAttribute(Class, String, Class)`
`SingleValueConverter` | `getConverterFromItemType(Class type)` Deprecated. since 1.3, use `getConverterFromItemType(String, Class, Class)`
`SingleValueConverter` | `getConverterFromItemType(String fieldName, Class type)` 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)` Deprecated. since 1.3
`boolean` | `shouldLookForSingleValueConverter(String fieldName, Class type, Class definedIn)`

Methods inherited from class com.thoughtworks.xstream.mapper.MapperWrapper
`aliasForAttribute, aliasForAttribute, aliasForSystemAttribute, attributeForAlias, attributeForAlias, attributeForClassDefiningField, attributeForEnumType, attributeForImplementationClass, attributeForReadResolveField, defaultImplementationOf, getFieldNameForItemTypeAndName, getImplicitCollectionDefForFieldName, getItemTypeForItemFieldName, getLocalConverter, 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`

Constructor Detail

### AttributeMapper

    public AttributeMapper(Mapper wrapped)

  Deprecated. since 1.3

### AttributeMapper

    public AttributeMapper(Mapper wrapped,
                           ConverterLookup converterLookup)

Method Detail

### setConverterLookup

    public void setConverterLookup(ConverterLookup converterLookup)

  Deprecated. since 1.3

### addAttributeFor

    public void addAttributeFor(String fieldName,
                                Class type)

### addAttributeFor

    public void addAttributeFor(Class type)

### getConverterFromItemType

    public SingleValueConverter getConverterFromItemType(String fieldName,
                                                         Class type)

  Deprecated. since 1.3, use `getConverterFromItemType(String, Class, Class)`

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

### shouldLookForSingleValueConverter

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

### getConverterFromItemType

    public SingleValueConverter getConverterFromItemType(Class type)

  Deprecated. since 1.3, use `getConverterFromItemType(String, Class, Class)`

  Specified by:
    `getConverterFromItemType` in interface `Mapper`
  Overrides:
    `getConverterFromItemType` in class `MapperWrapper`

### getConverterFromAttribute

    public SingleValueConverter getConverterFromAttribute(String attributeName)

  Deprecated. since 1.3, use `getConverterFromAttribute(Class, String, Class)`

  Specified by:
    `getConverterFromAttribute` in interface `Mapper`
  Overrides:
    `getConverterFromAttribute` in class `MapperWrapper`

### getConverterFromAttribute

    public SingleValueConverter getConverterFromAttribute(Class definedIn,
                                                          String attribute)

  Deprecated. since 1.3.1, use `getConverterFromAttribute(Class, String, Class)`

  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:
    `definedIn` - the field's parent
    `attribute` - the attribute name

### getConverterFromAttribute

    public SingleValueConverter getConverterFromAttribute(Class definedIn,
                                                          String attribute,
                                                          Class type)

  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:
    `definedIn` - the field's parent
    `attribute` - the attribute name
    `type` - the type the converter should create

### 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

### addAttributeFor

    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
  Since:
    1.3

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2008 XStream. All Rights Reserved.