com.thoughtworks.xstream.converters.reflection
Class SerializableConverter

java.lang.Object
  extended by com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
      extended by com.thoughtworks.xstream.converters.reflection.SerializableConverter
All Implemented Interfaces:
Converter, ConverterMatcher
Direct Known Subclasses:
CGLIBEnhancedConverter

public class SerializableConverter
extends AbstractReflectionConverter

Emulates the mechanism used by standard Java Serialization for classes that implement java.io.Serializable AND implement or inherit a custom readObject()/writeObject() method.

Supported features of serialization

Currently unsupported features

Author:
Joe Walnes, Jörg Schaible

Nested Class Summary
 
Nested classes/interfaces inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
AbstractReflectionConverter.DuplicateFieldException
 
Field Summary
 
Fields inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
mapper, reflectionProvider, serializationMethodInvoker
 
Constructor Summary
SerializableConverter(Mapper mapper, ReflectionProvider reflectionProvider)
           
 
Method Summary
 boolean canConvert(java.lang.Class type)
          Determines whether the converter can marshall a particular type.
 void doMarshal(java.lang.Object source, HierarchicalStreamWriter writer, MarshallingContext context)
           
protected  void doMarshalConditionally(java.lang.Object source, HierarchicalStreamWriter writer, MarshallingContext context)
           
 java.lang.Object doUnmarshal(java.lang.Object result, HierarchicalStreamReader reader, UnmarshallingContext context)
           
protected  java.lang.Object doUnmarshalConditionally(java.lang.Object result, HierarchicalStreamReader reader, UnmarshallingContext context)
           
protected  java.util.List hierarchyFor(java.lang.Class type)
           
 
Methods inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
instantiateNewInstance, marshal, marshallField, shouldUnmarshalTransientFields, unmarshal, unmarshallField
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializableConverter

public SerializableConverter(Mapper mapper,
                             ReflectionProvider reflectionProvider)
Method Detail

canConvert

public boolean canConvert(java.lang.Class type)
Description copied from interface: ConverterMatcher
Determines whether the converter can marshall a particular type.

Parameters:
type - the Class representing the object type to be converted

doMarshal

public void doMarshal(java.lang.Object source,
                      HierarchicalStreamWriter writer,
                      MarshallingContext context)
Overrides:
doMarshal in class AbstractReflectionConverter

hierarchyFor

protected java.util.List hierarchyFor(java.lang.Class type)

doUnmarshal

public java.lang.Object doUnmarshal(java.lang.Object result,
                                    HierarchicalStreamReader reader,
                                    UnmarshallingContext context)
Overrides:
doUnmarshal in class AbstractReflectionConverter

doMarshalConditionally

protected void doMarshalConditionally(java.lang.Object source,
                                      HierarchicalStreamWriter writer,
                                      MarshallingContext context)

doUnmarshalConditionally

protected java.lang.Object doUnmarshalConditionally(java.lang.Object result,
                                                    HierarchicalStreamReader reader,
                                                    UnmarshallingContext context)


Joe Walnes, http://xstream.codehaus.org/