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 EnumMapper

    java.lang.Object
      com.thoughtworks.xstream.mapper.MapperWrapper
          com.thoughtworks.xstream.mapper.EnumMapper

All Implemented Interfaces:
  Mapper

    public class EnumMapper

extends MapperWrapper

Mapper that handles the special case of polymorphic enums in Java 1.5. This renames MyEnum$1 to MyEnum making it less bloaty in the XML and avoiding the need for an alias per enum value to be specified. Additionally every enum is treated automatically as immutable type and can be written as attribute.

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
`EnumMapper(ClassMapper wrapped)` Deprecated. since 1.2, use `#EnumMapper(Mapper))`
`EnumMapper(Mapper wrapped)` Deprecated.
`EnumMapper(Mapper wrapped, ConverterLookup lookup)` Deprecated. since 1.3.1, use `EnumMapper(Mapper)`

Method Summary
`SingleValueConverter` | `getConverterFromAttribute(Class definedIn, String attribute, Class type)` Returns which converter to use for an specific attribute in a type.
`SingleValueConverter` | `getConverterFromItemType(String fieldName, Class type, Class definedIn)` Returns a single value converter to be used in a specific field.
`boolean` | `isImmutableValueType(Class type)` Whether this type is a simple immutable value (int, boolean, String, URL, etc.
`String` | `serializedClass(Class type)` How a class name should be represented in its serialized form.

Methods inherited from class com.thoughtworks.xstream.mapper.MapperWrapper
`aliasForAttribute, aliasForAttribute, aliasForSystemAttribute, attributeForAlias, attributeForAlias, attributeForClassDefiningField, attributeForEnumType, attributeForImplementationClass, attributeForReadResolveField, defaultImplementationOf, getConverterFromAttribute, getConverterFromAttribute, getConverterFromItemType, getConverterFromItemType, getFieldNameForItemTypeAndName, getImplicitCollectionDefForFieldName, getItemTypeForItemFieldName, getLocalConverter, lookupMapperOfType, realClass, realMember, serializedMember, shouldSerializeMember`

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

Constructor Detail

### EnumMapper

    public EnumMapper(Mapper wrapped,
                      ConverterLookup lookup)

  Deprecated. since 1.3.1, use `EnumMapper(Mapper)`

### EnumMapper

    @Deprecated
    public EnumMapper(Mapper wrapped)

  Deprecated.

### EnumMapper

    @Deprecated
    public EnumMapper(ClassMapper wrapped)

  Deprecated. since 1.2, use `#EnumMapper(Mapper))`

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`
  Overrides:
    `serializedClass` in class `MapperWrapper`

### 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`
  Overrides:
    `isImmutableValueType` 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.

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

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.