|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.thoughtworks.xstream.mapper.MapperWrapper
com.thoughtworks.xstream.mapper.EnumMapper
public class EnumMapper
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.
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(java.lang.Class definedIn,
java.lang.String attribute,
java.lang.Class type)
Returns which converter to use for an specific attribute in a type. |
SingleValueConverter |
getConverterFromItemType(java.lang.String fieldName,
java.lang.Class type,
java.lang.Class definedIn)
Returns a single value converter to be used in a specific field. |
boolean |
isImmutableValueType(java.lang.Class type)
Whether this type is a simple immutable value (int, boolean, String, URL, etc. |
java.lang.String |
serializedClass(java.lang.Class type)
How a class name should be represented in its serialized form. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EnumMapper(Mapper wrapped, ConverterLookup lookup)
EnumMapper(Mapper)
@Deprecated public EnumMapper(Mapper wrapped)
@Deprecated public EnumMapper(ClassMapper wrapped)
#EnumMapper(Mapper))
Method Detail |
---|
public java.lang.String serializedClass(java.lang.Class type)
Mapper
serializedClass
in interface Mapper
serializedClass
in class MapperWrapper
public boolean isImmutableValueType(java.lang.Class type)
Mapper
isImmutableValueType
in interface Mapper
isImmutableValueType
in class MapperWrapper
public SingleValueConverter getConverterFromItemType(java.lang.String fieldName, java.lang.Class type, java.lang.Class definedIn)
Mapper
getConverterFromItemType
in interface Mapper
getConverterFromItemType
in class MapperWrapper
fieldName
- the field nametype
- the field typedefinedIn
- the type which defines this field
public SingleValueConverter getConverterFromAttribute(java.lang.Class definedIn, java.lang.String attribute, java.lang.Class type)
Mapper
getConverterFromAttribute
in interface Mapper
getConverterFromAttribute
in class MapperWrapper
definedIn
- the field's parentattribute
- the attribute nametype
- the type the converter should create
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |