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, Caching
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, AbstractReflectionConverter.UnknownFieldException
 
Field Summary
 
Fields inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
mapper, reflectionProvider, serializationMethodInvoker
 
Constructor Summary
SerializableConverter(Mapper mapper, ReflectionProvider reflectionProvider)
          Deprecated. As of 1.4 use SerializableConverter(Mapper, ReflectionProvider, ClassLoader)
SerializableConverter(Mapper mapper, ReflectionProvider reflectionProvider, ClassLoader classLoader)
           
 
Method Summary
 boolean canConvert(Class type)
          Determines whether the converter can marshall a particular type.
 void doMarshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context)
           
protected  void doMarshalConditionally(Object source, HierarchicalStreamWriter writer, MarshallingContext context)
           
 Object doUnmarshal(Object result, HierarchicalStreamReader reader, UnmarshallingContext context)
           
protected  Object doUnmarshalConditionally(Object result, HierarchicalStreamReader reader, UnmarshallingContext context)
           
protected  List hierarchyFor(Class type)
           
protected  void marshalUnserializableParent(HierarchicalStreamWriter writer, MarshallingContext context, Object replacedSource)
           
 
Methods inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
flushCache, 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,
                             ClassLoader classLoader)

SerializableConverter

public SerializableConverter(Mapper mapper,
                             ReflectionProvider reflectionProvider)
Deprecated. As of 1.4 use SerializableConverter(Mapper, ReflectionProvider, ClassLoader)

Method Detail

canConvert

public boolean canConvert(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(Object source,
                      HierarchicalStreamWriter writer,
                      MarshallingContext context)
Overrides:
doMarshal in class AbstractReflectionConverter

marshalUnserializableParent

protected void marshalUnserializableParent(HierarchicalStreamWriter writer,
                                           MarshallingContext context,
                                           Object replacedSource)

hierarchyFor

protected List hierarchyFor(Class type)

doUnmarshal

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

doMarshalConditionally

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

doUnmarshalConditionally

protected Object doUnmarshalConditionally(Object result,
                                          HierarchicalStreamReader reader,
                                          UnmarshallingContext context)


Copyright © 2004-2014 XStream. All Rights Reserved.