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 DefaultMapper

    java.lang.Object
      com.thoughtworks.xstream.mapper.DefaultMapper

All Implemented Interfaces:
  Mapper

    public class DefaultMapper

extends Object
implements Mapper

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

Author:
  Joe Walnes, Jörg Schaible

Nested Class Summary

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

Constructor Summary
`DefaultMapper(ClassLoader classLoader)`
`DefaultMapper(ClassLoader classLoader, String classAttributeIdentifier)` Deprecated. since 1.2, use XStream.aliasAttrbute() for a different attribute name.

Method Summary
`String` | `aliasForAttribute(Class definedIn, String fieldName)` Deprecated. since 1.3, use combination of `serializedMember(Class, String)` and `getConverterFromItemType(String, Class, Class)`
`String` | `aliasForAttribute(String attribute)` Get the alias for an attribute's name.
`String` | `aliasForSystemAttribute(String attribute)` Get the alias for a system attribute's name.
`String` | `attributeForAlias(Class definedIn, String alias)` 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()` Deprecated. since 1.2, use aliasForAttribute instead.
`String` | `attributeForEnumType()` Deprecated. since 1.2, use aliasForAttribute instead.
`String` | `attributeForImplementationClass()` Deprecated. since 1.2, use aliasForAttribute instead.
`String` | `attributeForReadResolveField()` Deprecated. since 1.2, use aliasForAttribute instead.
`Class` | `defaultImplementationOf(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 name)` 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.
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultMapper

    public DefaultMapper(ClassLoader classLoader)

### DefaultMapper

    public DefaultMapper(ClassLoader classLoader,
                         String classAttributeIdentifier)

  Deprecated. since 1.2, use XStream.aliasAttrbute() for a different attribute name.

Method Detail

### serializedClass

    public String serializedClass(Class type)

  Description copied from interface: `Mapper`
  How a class name should be represented in its serialized form.

  Specified by:
    `serializedClass` in interface `Mapper`

### realClass

    public Class realClass(String elementName)

  Description copied from interface: `Mapper`
  How a serialized class representation should be mapped back to a real class.

  Specified by:
    `realClass` in interface `Mapper`

### defaultImplementationOf

    public Class defaultImplementationOf(Class type)

  Specified by:
    `defaultImplementationOf` in interface `Mapper`

### attributeForClassDefiningField

    public String attributeForClassDefiningField()

  Deprecated. since 1.2, use aliasForAttribute instead.

  Specified by:
    `attributeForClassDefiningField` in interface `Mapper`

### attributeForReadResolveField

    public String attributeForReadResolveField()

  Deprecated. since 1.2, use aliasForAttribute instead.

  Specified by:
    `attributeForReadResolveField` in interface `Mapper`

### attributeForEnumType

    public String attributeForEnumType()

  Deprecated. since 1.2, use aliasForAttribute instead.

  Specified by:
    `attributeForEnumType` in interface `Mapper`

### attributeForImplementationClass

    public String attributeForImplementationClass()

  Deprecated. since 1.2, use aliasForAttribute instead.

  Specified by:
    `attributeForImplementationClass` in interface `Mapper`

### aliasForAttribute

    public String aliasForAttribute(String attribute)

  Description copied from interface: `Mapper`
  Get the alias for an attribute's name.

  Specified by:
    `aliasForAttribute` in interface `Mapper`
  Parameters:
    `attribute` - the attribute
  Returns:
    the alias

### attributeForAlias

    public String attributeForAlias(String alias)

  Description copied from interface: `Mapper`
  Get the attribute's name for an alias.

  Specified by:
    `attributeForAlias` in interface `Mapper`
  Parameters:
    `alias` - the alias
  Returns:
    the attribute's name

### aliasForSystemAttribute

    public String aliasForSystemAttribute(String attribute)

  Description copied from interface: `Mapper`
  Get the alias for a system attribute's name.

  Specified by:
    `aliasForSystemAttribute` in interface `Mapper`
  Parameters:
    `attribute` - the system attribute
  Returns:
    the alias

### isImmutableValueType

    public boolean isImmutableValueType(Class type)

  Description copied from interface: `Mapper`
  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.

  Specified by:
    `isImmutableValueType` in interface `Mapper`

### getFieldNameForItemTypeAndName

    public String getFieldNameForItemTypeAndName(Class definedIn,
                                                 Class itemType,
                                                 String itemFieldName)

  Description copied from interface: `Mapper`
  Get the name of the field that acts as the default collection for an object, or return null if there is none.

  Specified by:
    `getFieldNameForItemTypeAndName` in interface `Mapper`
  Parameters:
    `definedIn` - owning type
    `itemType` - item type
    `itemFieldName` - optional item element name

### getItemTypeForItemFieldName

    public Class getItemTypeForItemFieldName(Class definedIn,
                                             String itemFieldName)

  Specified by:
    `getItemTypeForItemFieldName` in interface `Mapper`

### getImplicitCollectionDefForFieldName

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

  Specified by:
    `getImplicitCollectionDefForFieldName` in interface `Mapper`

### shouldSerializeMember

    public boolean shouldSerializeMember(Class definedIn,
                                         String fieldName)

  Description copied from interface: `Mapper`
  Determine whether a specific member should be serialized.

  Specified by:
    `shouldSerializeMember` in interface `Mapper`

### lookupName

    public String lookupName(Class type)

### lookupType

    public Class lookupType(String elementName)

### serializedMember

    public String serializedMember(Class type,
                                   String memberName)

  Description copied from interface: `Mapper`
  How a class member should be represented in its serialized form.

  Specified by:
    `serializedMember` in interface `Mapper`

### realMember

    public String realMember(Class type,
                             String serialized)

  Description copied from interface: `Mapper`
  How a serialized member representation should be mapped back to a real member.

  Specified by:
    `realMember` in interface `Mapper`

### getConverterFromAttribute

    public SingleValueConverter getConverterFromAttribute(String name)

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

  Specified by:
    `getConverterFromAttribute` in interface `Mapper`

### getConverterFromItemType

    public SingleValueConverter getConverterFromItemType(String fieldName,
                                                         Class type)

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

  Specified by:
    `getConverterFromItemType` in interface `Mapper`

### getConverterFromItemType

    public SingleValueConverter getConverterFromItemType(Class type)

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

  Specified by:
    `getConverterFromItemType` in interface `Mapper`

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

### getLocalConverter

    public Converter getLocalConverter(Class definedIn,
                                       String fieldName)

  Specified by:
    `getLocalConverter` in interface `Mapper`

### lookupMapperOfType

    public Mapper lookupMapperOfType(Class type)

  Specified by:
    `lookupMapperOfType` in interface `Mapper`

### aliasForAttribute

    public String aliasForAttribute(Class definedIn,
                                    String fieldName)

  Deprecated. since 1.3, use combination of `serializedMember(Class, String)` and `getConverterFromItemType(String, Class, Class)`

  Description copied from interface: `Mapper`
  Returns an alias for a single field defined in an specific type.

  Specified by:
    `aliasForAttribute` in interface `Mapper`
  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

### attributeForAlias

    public String attributeForAlias(Class definedIn,
                                    String alias)

  Deprecated. since 1.3, use combination of `realMember(Class, String)` and `getConverterFromItemType(String, Class, Class)`

  Description copied from interface: `Mapper`
  Returns the field name for an aliased attribute.

  Specified by:
    `attributeForAlias` in interface `Mapper`
  Parameters:
    `definedIn` - the type where the field was defined
    `alias` - the alias
  Returns:
    the original attribute name

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

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.