public class InterfaceClassMapper
extends com.thoughtworks.xstream.mapper.MapperWrapper
| Constructor and Description |
|---|
InterfaceClassMapper(WriterStack writerStack,
com.thoughtworks.xstream.mapper.Mapper wrapped,
List<ClassFieldMapping> elementMappingList,
List<ClassFieldMapping> listElementMappingList,
List<ImplicitCollectionFieldMapping> itemFieldMappings,
com.google.common.collect.Multimap<String,Class<?>> omitMMap,
Map<String,Class<?>> elementClassMap)
Create an Interface Class Mapper with a configuration.
|
| Modifier and Type | Method and Description |
|---|---|
com.thoughtworks.xstream.mapper.Mapper.ImplicitCollectionMapping |
getImplicitCollectionDefForFieldName(Class itemType,
String fieldName) |
Class |
realClass(String elementName)
Get the real class associated with an element name from the
elementMappingList.
|
String |
serializedClass(Class type)
Get the serialized element name for a specific class.
|
void |
setBaseObject(Object base)
Set the base object at the start of a serialization, this ensures that the
base element type is appropriate for the elements that are contained within
the object.
|
boolean |
shouldSerializeMember(Class definedIn,
String fieldName)
Checks to see if the field in a class should be serialized.
|
aliasForAttribute, aliasForAttribute, aliasForSystemAttribute, attributeForAlias, attributeForAlias, attributeForClassDefiningField, attributeForEnumType, attributeForImplementationClass, attributeForReadResolveField, defaultImplementationOf, getConverterFromAttribute, getConverterFromAttribute, getConverterFromAttribute, getConverterFromItemType, getConverterFromItemType, getConverterFromItemType, getFieldNameForItemTypeAndName, getItemTypeForItemFieldName, getLocalConverter, isImmutableValueType, lookupMapperOfType, realMember, serializedMemberpublic InterfaceClassMapper(WriterStack writerStack, com.thoughtworks.xstream.mapper.Mapper wrapped, List<ClassFieldMapping> elementMappingList, List<ClassFieldMapping> listElementMappingList, List<ImplicitCollectionFieldMapping> itemFieldMappings, com.google.common.collect.Multimap<String,Class<?>> omitMMap, Map<String,Class<?>> elementClassMap)
writerStack - A thread safe WriterStack implementation connected to the XStream
driver and hence all the writers.wrapped - the base mapper to be wrapped by this wrapper. All mappers must
wrap the default mapper.elementMappingList - A list of element to class mappings specified by ClassFieldMapping
Object. This list is priority ordered with the highest priority
mappings coming first.listElementMappingList - A list of element names to use as the base element where there is
a collection of the same type objects being serialized.omitMMap - A Multimap of fields in classes to omit from serialization.elementClassMap - a map of element names to class types.public void setBaseObject(Object base)
base - the base object being serialized.public String serializedClass(Class type)
Get the serialized element name for a specific class. If this is the first object to be serialized, and it is a collection, then the elements of the collection will have been inspected to determine if the container should have a special name. These names are specified in the listElementMappingList which is specified on construction. If the first element is not found a standard list.container element name is used to contain all the others, this list type is only ever used in the unit tests.
For subsequent elements, the class is mapped directly to a element name at the same level, specified via the elementMappingList which is injected in the constructor. This mapping looks to see if the class in question inherits of extends the classes in the list and uses the element name associated wit the first match.
serializedClass in interface com.thoughtworks.xstream.mapper.MapperserializedClass in class com.thoughtworks.xstream.mapper.MapperWrappertype - the type of the class to the serializedMapperWrapper.serializedClass(java.lang.Class)public boolean shouldSerializeMember(Class definedIn, String fieldName)
shouldSerializeMember in interface com.thoughtworks.xstream.mapper.MappershouldSerializeMember in class com.thoughtworks.xstream.mapper.MapperWrapperdefinedIn - the class the field is defined infieldName - the field being consideredMapperWrapper.shouldSerializeMember(java.lang.Class,
java.lang.String)public Class realClass(String elementName)
realClass in interface com.thoughtworks.xstream.mapper.MapperrealClass in class com.thoughtworks.xstream.mapper.MapperWrapperelementName - the name of the element being read.MapperWrapper.realClass(java.lang.String)public com.thoughtworks.xstream.mapper.Mapper.ImplicitCollectionMapping getImplicitCollectionDefForFieldName(Class itemType, String fieldName)
getImplicitCollectionDefForFieldName in interface com.thoughtworks.xstream.mapper.MappergetImplicitCollectionDefForFieldName in class com.thoughtworks.xstream.mapper.MapperWrapperMapperWrapper.getImplicitCollectionDefForFieldName(java.lang.Class, java.lang.String)Copyright © 2007-2012. All Rights Reserved.