com.thoughtworks.xstream.mapper
Class EnumMapper
java.lang.Object
com.thoughtworks.xstream.mapper.MapperWrapper
com.thoughtworks.xstream.mapper.AttributeMapper
com.thoughtworks.xstream.mapper.EnumMapper
- All Implemented Interfaces:
- Mapper
public class EnumMapper
- extends AttributeMapper
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
Methods inherited from class com.thoughtworks.xstream.mapper.MapperWrapper |
aliasForAttribute, aliasForAttribute, attributeForAlias, attributeForAlias, attributeForClassDefiningField, attributeForEnumType, attributeForImplementationClass, attributeForReadResolveField, defaultImplementationOf, 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 |
EnumMapper
public EnumMapper(Mapper wrapped,
ConverterLookup converterLookup)
EnumMapper
@Deprecated
public EnumMapper(Mapper wrapped)
- Deprecated. since 1.3, use
EnumMapper(Mapper, ConverterLookup)
EnumMapper
@Deprecated
public EnumMapper(ClassMapper wrapped)
- Deprecated. since 1.2, use
#EnumMapper(Mapper, ConverterLookup))
serializedClass
public java.lang.String serializedClass(java.lang.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(java.lang.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
getLocalConverterFromItemType
protected SingleValueConverter getLocalConverterFromItemType(java.lang.Class type)
- Overrides:
getLocalConverterFromItemType
in class AttributeMapper
Joe Walnes, http://xstream.codehaus.org/