Package com.attivio.util.serialization
Class AbstractAttivioReflectionConverter
- java.lang.Object
-
- com.attivio.util.serialization.AbstractConverter
-
- com.attivio.util.serialization.AbstractPlatformMessageConverter
-
- com.attivio.util.serialization.AbstractAttivioReflectionConverter
-
- All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter
,com.thoughtworks.xstream.converters.ConverterMatcher
public abstract class AbstractAttivioReflectionConverter extends AbstractPlatformMessageConverter
Simple serialization converter that uses reflection to automatically generate XML serialization/deserialization. For complex class hierarchies, this probably isn't the best class to extend, since it will be somewhat inefficient and verbose in the XML generation. But for simple conversion of simple POJOs, it is easy to just extend this abstract class and then only implement the "canConvert" method.For example:
public boolean canConvert(Class type) { return SqlSchemaRequest.class.equals(type); }
Note: if the class you are converting does not have a zero argument constructor, create a private one that reflection can use.
-
-
Field Summary
-
Fields inherited from class com.attivio.util.serialization.AbstractPlatformMessageConverter
log
-
Fields inherited from class com.attivio.util.serialization.AbstractConverter
mapper, NULL
-
-
Constructor Summary
Constructors Constructor Description AbstractAttivioReflectionConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
marshal(java.lang.Object source, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context)
java.lang.Object
unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
-
Methods inherited from class com.attivio.util.serialization.AbstractPlatformMessageConverter
marshalMessage, unmarshalMessage
-
Methods inherited from class com.attivio.util.serialization.AbstractConverter
addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, getAlias, getAlias, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getClass, getClass, getClassName, marshalArray, marshalArray, marshalArray2D, marshalIntArray, marshalIntArray, marshalList, marshalNode, marshalNode, marshalProperties, marshalProperties, readList, readSubObject, readThrowable, setMapper, unmarshalArray, unmarshalArray2D, unmarshalIntArray, unmarshalList, unmarshalNode, unmarshalNode, unmarshalNode, unmarshalNode, unmarshalProperties, unmarshalProperty, unmarshalPropertyName, unmarshalPropertyValue, writeSubObject, writeSubObject, writeThrowable
-
-
-
-
Method Detail
-
marshal
public void marshal(java.lang.Object source, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context)
-
unmarshal
public java.lang.Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
-
-