Package com.thoughtworks.xstream.mapper
Class MapperWrapper
- java.lang.Object
-
- com.thoughtworks.xstream.mapper.MapperWrapper
-
- All Implemented Interfaces:
Mapper
- Direct Known Subclasses:
AbstractAttributeAliasingMapper
,AbstractXmlFriendlyMapper
,AnnotationMapper
,ArrayMapper
,AttributeMapper
,CachingMapper
,CGLIBMapper
,ClassAliasingMapper
,DefaultImplementationsMapper
,DynamicProxyMapper
,ElementIgnoringMapper
,EnumMapper
,FieldAliasingMapper
,ImmutableTypesMapper
,ImplicitCollectionMapper
,LambdaMapper
,LocalConversionMapper
,OuterClassMapper
,PackageAliasingMapper
,SecurityMapper
public abstract class MapperWrapper extends java.lang.Object implements Mapper
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.thoughtworks.xstream.mapper.Mapper
Mapper.ImplicitCollectionMapping, Mapper.Null
-
-
Field Summary
Fields Modifier and Type Field Description private Mapper
aliasForAttributeMapper
private Mapper
aliasForSystemAttributeMapper
private Mapper
attributeForAliasMapper
private Mapper
defaultImplementationOfMapper
private Mapper
getConverterFromAttributeMapper
private Mapper
getConverterFromItemTypeMapper
private Mapper
getFieldNameForItemTypeAndNameMapper
private Mapper
getImplicitCollectionDefForFieldNameMapper
private Mapper
getItemTypeForItemFieldNameMapper
private Mapper
getLocalConverterMapper
private Mapper
isIgnoredElementMapper
private Mapper
isImmutableValueTypeMapper
private Mapper
isReferenceableMapper
private Mapper
realClassMapper
private Mapper
realMemberMapper
private Mapper
serializedClassMapper
private Mapper
serializedMemberMapper
private Mapper
shouldSerializeMemberMapper
private Mapper
wrapped
-
Constructor Summary
Constructors Constructor Description MapperWrapper(Mapper wrapped)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.String
aliasForAttribute(java.lang.Class definedIn, java.lang.String fieldName)
Deprecated.As of 1.3, use combination ofserializedMember(Class, String)
andgetConverterFromItemType(String, Class, Class)
java.lang.String
aliasForAttribute(java.lang.String attribute)
Get the alias for an attribute's name.java.lang.String
aliasForSystemAttribute(java.lang.String attribute)
Get the alias for a system attribute's name.java.lang.String
attributeForAlias(java.lang.Class definedIn, java.lang.String alias)
Deprecated.As of 1.3, use combination ofrealMember(Class, String)
andgetConverterFromItemType(String, Class, Class)
java.lang.String
attributeForAlias(java.lang.String alias)
Get the attribute's name for an alias.java.lang.Class
defaultImplementationOf(java.lang.Class type)
SingleValueConverter
getConverterFromAttribute(java.lang.Class type, java.lang.String attribute)
Deprecated.As of 1.3.1, usegetConverterFromAttribute(Class, String, Class)
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
getConverterFromAttribute(java.lang.String name)
Deprecated.As of 1.3, usegetConverterFromAttribute(Class, String, Class)
SingleValueConverter
getConverterFromItemType(java.lang.Class type)
Deprecated.As of 1.3, usegetConverterFromItemType(String, Class, Class)
SingleValueConverter
getConverterFromItemType(java.lang.String fieldName, java.lang.Class type)
Deprecated.As of 1.3, usegetConverterFromItemType(String, Class, Class)
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.java.lang.String
getFieldNameForItemTypeAndName(java.lang.Class definedIn, java.lang.Class itemType, java.lang.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(java.lang.Class itemType, java.lang.String fieldName)
java.lang.Class
getItemTypeForItemFieldName(java.lang.Class definedIn, java.lang.String itemFieldName)
Converter
getLocalConverter(java.lang.Class definedIn, java.lang.String fieldName)
boolean
isIgnoredElement(java.lang.String name)
Whether this name can be ignored.boolean
isImmutableValueType(java.lang.Class type)
Whether this type is a simple immutable value (int, boolean, String, URL, etc).boolean
isReferenceable(java.lang.Class type)
Whether this type is referenceable in a stream.Mapper
lookupMapperOfType(java.lang.Class type)
java.lang.Class
realClass(java.lang.String elementName)
How a serialized class representation should be mapped back to a real class.java.lang.String
realMember(java.lang.Class type, java.lang.String serialized)
How a serialized member representation should be mapped back to a real member.java.lang.String
serializedClass(java.lang.Class type)
How a class name should be represented in its serialized form.java.lang.String
serializedMember(java.lang.Class type, java.lang.String memberName)
How a class member should be represented in its serialized form.boolean
shouldSerializeMember(java.lang.Class definedIn, java.lang.String fieldName)
Determine whether a specific member should be serialized.
-
-
-
Field Detail
-
wrapped
private final Mapper wrapped
-
aliasForAttributeMapper
private final Mapper aliasForAttributeMapper
-
aliasForSystemAttributeMapper
private final Mapper aliasForSystemAttributeMapper
-
attributeForAliasMapper
private final Mapper attributeForAliasMapper
-
defaultImplementationOfMapper
private final Mapper defaultImplementationOfMapper
-
getConverterFromAttributeMapper
private final Mapper getConverterFromAttributeMapper
-
getConverterFromItemTypeMapper
private final Mapper getConverterFromItemTypeMapper
-
getFieldNameForItemTypeAndNameMapper
private final Mapper getFieldNameForItemTypeAndNameMapper
-
getImplicitCollectionDefForFieldNameMapper
private final Mapper getImplicitCollectionDefForFieldNameMapper
-
getItemTypeForItemFieldNameMapper
private final Mapper getItemTypeForItemFieldNameMapper
-
getLocalConverterMapper
private final Mapper getLocalConverterMapper
-
isIgnoredElementMapper
private final Mapper isIgnoredElementMapper
-
isImmutableValueTypeMapper
private final Mapper isImmutableValueTypeMapper
-
isReferenceableMapper
private final Mapper isReferenceableMapper
-
realClassMapper
private final Mapper realClassMapper
-
realMemberMapper
private final Mapper realMemberMapper
-
serializedClassMapper
private final Mapper serializedClassMapper
-
serializedMemberMapper
private final Mapper serializedMemberMapper
-
shouldSerializeMemberMapper
private final Mapper shouldSerializeMemberMapper
-
-
Constructor Detail
-
MapperWrapper
public MapperWrapper(Mapper wrapped)
-
-
Method Detail
-
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 interfaceMapper
-
realClass
public java.lang.Class realClass(java.lang.String elementName)
Description copied from interface:Mapper
How a serialized class representation should be mapped back to a real class.
-
serializedMember
public java.lang.String serializedMember(java.lang.Class type, java.lang.String memberName)
Description copied from interface:Mapper
How a class member should be represented in its serialized form.- Specified by:
serializedMember
in interfaceMapper
-
realMember
public java.lang.String realMember(java.lang.Class type, java.lang.String serialized)
Description copied from interface:Mapper
How a serialized member representation should be mapped back to a real member.- Specified by:
realMember
in interfaceMapper
-
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 interfaceMapper
-
isReferenceable
public boolean isReferenceable(java.lang.Class type)
Description copied from interface:Mapper
Whether this type is referenceable in a stream.- Specified by:
isReferenceable
in interfaceMapper
-
defaultImplementationOf
public java.lang.Class defaultImplementationOf(java.lang.Class type)
- Specified by:
defaultImplementationOf
in interfaceMapper
-
aliasForAttribute
public java.lang.String aliasForAttribute(java.lang.String attribute)
Description copied from interface:Mapper
Get the alias for an attribute's name.- Specified by:
aliasForAttribute
in interfaceMapper
- Parameters:
attribute
- the attribute- Returns:
- the alias
-
attributeForAlias
public java.lang.String attributeForAlias(java.lang.String alias)
Description copied from interface:Mapper
Get the attribute's name for an alias.- Specified by:
attributeForAlias
in interfaceMapper
- Parameters:
alias
- the alias- Returns:
- the attribute's name
-
aliasForSystemAttribute
public java.lang.String aliasForSystemAttribute(java.lang.String attribute)
Description copied from interface:Mapper
Get the alias for a system attribute's name.- Specified by:
aliasForSystemAttribute
in interfaceMapper
- Parameters:
attribute
- the system attribute- Returns:
- the alias
-
getFieldNameForItemTypeAndName
public java.lang.String getFieldNameForItemTypeAndName(java.lang.Class definedIn, java.lang.Class itemType, java.lang.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 interfaceMapper
- Parameters:
definedIn
- owning typeitemType
- item typeitemFieldName
- optional item element name
-
getItemTypeForItemFieldName
public java.lang.Class getItemTypeForItemFieldName(java.lang.Class definedIn, java.lang.String itemFieldName)
- Specified by:
getItemTypeForItemFieldName
in interfaceMapper
-
getImplicitCollectionDefForFieldName
public Mapper.ImplicitCollectionMapping getImplicitCollectionDefForFieldName(java.lang.Class itemType, java.lang.String fieldName)
- Specified by:
getImplicitCollectionDefForFieldName
in interfaceMapper
-
shouldSerializeMember
public boolean shouldSerializeMember(java.lang.Class definedIn, java.lang.String fieldName)
Description copied from interface:Mapper
Determine whether a specific member should be serialized.- Specified by:
shouldSerializeMember
in interfaceMapper
-
isIgnoredElement
public boolean isIgnoredElement(java.lang.String name)
Description copied from interface:Mapper
Whether this name can be ignored.- Specified by:
isIgnoredElement
in interfaceMapper
-
getConverterFromItemType
public SingleValueConverter getConverterFromItemType(java.lang.String fieldName, java.lang.Class type)
Deprecated.As of 1.3, usegetConverterFromItemType(String, Class, Class)
- Specified by:
getConverterFromItemType
in interfaceMapper
-
getConverterFromItemType
public SingleValueConverter getConverterFromItemType(java.lang.Class type)
Deprecated.As of 1.3, usegetConverterFromItemType(String, Class, Class)
- Specified by:
getConverterFromItemType
in interfaceMapper
-
getConverterFromAttribute
public SingleValueConverter getConverterFromAttribute(java.lang.String name)
Deprecated.As of 1.3, usegetConverterFromAttribute(Class, String, Class)
- Specified by:
getConverterFromAttribute
in interfaceMapper
-
getLocalConverter
public Converter getLocalConverter(java.lang.Class definedIn, java.lang.String fieldName)
- Specified by:
getLocalConverter
in interfaceMapper
-
lookupMapperOfType
public Mapper lookupMapperOfType(java.lang.Class type)
- Specified by:
lookupMapperOfType
in interfaceMapper
-
getConverterFromItemType
public SingleValueConverter getConverterFromItemType(java.lang.String fieldName, java.lang.Class type, java.lang.Class definedIn)
Description copied from interface:Mapper
Returns a single value converter to be used in a specific field.- Specified by:
getConverterFromItemType
in interfaceMapper
- Parameters:
fieldName
- the field nametype
- the field typedefinedIn
- the type which defines this field- Returns:
- a SingleValueConverter or null if there no such converter should be used for this field.
-
aliasForAttribute
public java.lang.String aliasForAttribute(java.lang.Class definedIn, java.lang.String fieldName)
Deprecated.As of 1.3, use combination ofserializedMember(Class, String)
andgetConverterFromItemType(String, Class, Class)
Description copied from interface:Mapper
Returns an alias for a single field defined in an specific type.- Specified by:
aliasForAttribute
in interfaceMapper
- Parameters:
definedIn
- the type where the field was definedfieldName
- the field name- Returns:
- the alias for this field or its own name if no alias was defined
-
attributeForAlias
public java.lang.String attributeForAlias(java.lang.Class definedIn, java.lang.String alias)
Deprecated.As of 1.3, use combination ofrealMember(Class, String)
andgetConverterFromItemType(String, Class, Class)
Description copied from interface:Mapper
Returns the field name for an aliased attribute.- Specified by:
attributeForAlias
in interfaceMapper
- Parameters:
definedIn
- the type where the field was definedalias
- the alias- Returns:
- the original attribute name
-
getConverterFromAttribute
public SingleValueConverter getConverterFromAttribute(java.lang.Class type, java.lang.String attribute)
Deprecated.As of 1.3.1, usegetConverterFromAttribute(Class, String, Class)
Description copied from interface:Mapper
Returns which converter to use for an specific attribute in a type.- Specified by:
getConverterFromAttribute
in interfaceMapper
- Parameters:
type
- the field's parentattribute
- the attribute name
-
getConverterFromAttribute
public SingleValueConverter getConverterFromAttribute(java.lang.Class definedIn, java.lang.String attribute, java.lang.Class type)
Description copied from interface:Mapper
Returns which converter to use for an specific attribute in a type.- Specified by:
getConverterFromAttribute
in interfaceMapper
- Parameters:
definedIn
- the field's parentattribute
- the attribute nametype
- the type the converter should create
-
-