|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.thoughtworks.xstream.mapper.MapperWrapper
org.apache.shindig.protocol.conversion.xstream.InterfaceClassMapper
public class InterfaceClassMapper
The InterfaceClassMapper provides the central mapping of the XStream bean converter. It is used by XStream to determine the element names and classes being mapped. This is driven by a number of read only data structures that are injected on creation. The resolution of classes follow the inheritance model. To map all collections to an element we would use the Collection.class as the reference class and then ArrayList and Set would both be mapped to the same element.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.thoughtworks.xstream.mapper.Mapper |
|---|
com.thoughtworks.xstream.mapper.Mapper.ImplicitCollectionMapping, com.thoughtworks.xstream.mapper.Mapper.Null |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class com.thoughtworks.xstream.mapper.MapperWrapper |
|---|
aliasForAttribute, aliasForAttribute, aliasForSystemAttribute, attributeForAlias, attributeForAlias, attributeForClassDefiningField, attributeForEnumType, attributeForImplementationClass, attributeForReadResolveField, defaultImplementationOf, getConverterFromAttribute, getConverterFromAttribute, getConverterFromAttribute, getConverterFromItemType, getConverterFromItemType, getConverterFromItemType, getFieldNameForItemTypeAndName, getItemTypeForItemFieldName, getLocalConverter, isImmutableValueType, lookupMapperOfType, realMember, serializedMember |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public 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.| Method Detail |
|---|
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 serialized
MapperWrapper.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 considered
MapperWrapper.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)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||