Top Description Inners Fields Constructors Methods
com.thoughtworks.xstream.converters.reflection

public Class SerializableConverter

extends AbstractReflectionConverter
Class Inheritance
Known Direct Subclasses
com.thoughtworks.xstream.converters.reflection.CGLIBEnhancedConverter, com.thoughtworks.xstream.converters.reflection.LambdaConverter
Imports
java.io.IOException, .InvalidObjectException, .ObjectInputValidation, .ObjectStreamClass, .ObjectStreamField, .Serializable, java.lang.reflect.Field, java.util.ArrayList, .Collections, .HashMap, .Iterator, .List, .Map, com.thoughtworks.xstream.converters.ConversionException, .MarshallingContext, .UnmarshallingContext, com.thoughtworks.xstream.core.ClassLoaderReference, .JVM, com.thoughtworks.xstream.core.util.CustomObjectInputStream, .CustomObjectOutputStream, .Fields, .HierarchicalStreams, com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriterHelper, .HierarchicalStreamReader, .HierarchicalStreamWriter, .StreamException, com.thoughtworks.xstream.mapper.Mapper

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

Authors
Joe Walnes, Jörg Schaible

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final String
private static final String
private final ClassLoaderReference
private static final String
private static final String
private static final String
private static final String
private static final String
Inherited from com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter:
mapperreflectionProviderserializationMembersserializationMethodInvoker

Constructor Summary

AccessConstructor and Description
public
SerializableConverter(Mapper
the mapper chain instance
mapper
,
ReflectionProvider
the reflection provider
reflectionProvider
,
ClassLoaderReference
the reference to the ClassLoader of the XStream instance
classLoaderReference
)

Construct a SerializableConverter.

public
public

Method Summary

Modifier and TypeMethod and Description
public boolean
canConvert(Class<T>
the Class representing the object type to be converted
type
)

Implements com.thoughtworks.xstream.converters.ConverterMatcher.canConvert.

Determines whether the converter can marshall a particular type.
public void
protected void
doMarshalConditionally(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context)

public Object
protected Object
protected List<E>
private boolean
protected void
marshalUnserializableParent(final HierarchicalStreamWriter writer, final MarshallingContext context, final Object replacedSource)

private Object
readField(ObjectStreamField field, Class<T> type, Object instance)

Inherited from com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter:
canAccessflushCacheinstantiateNewInstancemarshalmarshallFieldreadResolveshouldUnmarshalFieldshouldUnmarshalTransientFieldsunmarshalunmarshallField

Field Detail

ATTRIBUTE_CLASSback to summary
private static final String ATTRIBUTE_CLASS
ATTRIBUTE_NAMEback to summary
private static final String ATTRIBUTE_NAME
ATTRIBUTE_SERIALIZATIONback to summary
private static final String ATTRIBUTE_SERIALIZATION
ATTRIBUTE_VALUE_CUSTOMback to summary
private static final String ATTRIBUTE_VALUE_CUSTOM
classLoaderReferenceback to summary
private final ClassLoaderReference classLoaderReference
ELEMENT_DEFAULTback to summary
private static final String ELEMENT_DEFAULT
ELEMENT_FIELDback to summary
private static final String ELEMENT_FIELD
ELEMENT_FIELDSback to summary
private static final String ELEMENT_FIELDS
ELEMENT_NULLback to summary
private static final String ELEMENT_NULL
ELEMENT_UNSERIALIZABLE_PARENTSback to summary
private static final String ELEMENT_UNSERIALIZABLE_PARENTS

Constructor Detail

SerializableConverterback to summary
public SerializableConverter(Mapper mapper, ReflectionProvider reflectionProvider, ClassLoaderReference classLoaderReference)

Construct a SerializableConverter.

Parameters
mapper:Mapper

the mapper chain instance

reflectionProvider:ReflectionProvider

the reflection provider

classLoaderReference:ClassLoaderReference

the reference to the ClassLoader of the XStream instance

Since
1.4.5
SerializableConverterback to summary
public SerializableConverter(Mapper mapper, ReflectionProvider reflectionProvider, ClassLoader classLoader)
SerializableConverterback to summary
public SerializableConverter(Mapper mapper, ReflectionProvider reflectionProvider)

Method Detail

canConvertback to summary
public boolean canConvert(Class<T> type)

Implements com.thoughtworks.xstream.converters.ConverterMatcher.canConvert.

Doc from com.thoughtworks.xstream.converters.ConverterMatcher.canConvert.

Determines whether the converter can marshall a particular type.

Parameters
type:Class<T>

the Class representing the object type to be converted

doMarshalback to summary
public void doMarshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context)

Overrides com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal.

doMarshalConditionallyback to summary
protected void doMarshalConditionally(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context)
doUnmarshalback to summary
public Object doUnmarshal(final Object result, final HierarchicalStreamReader reader, final UnmarshallingContext context)

Overrides com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal.

doUnmarshalConditionallyback to summary
protected Object doUnmarshalConditionally(final Object result, final HierarchicalStreamReader reader, final UnmarshallingContext context)
hierarchyForback to summary
protected List<E> hierarchyFor(Class<T> type)
isSerializableback to summary
private boolean isSerializable(Class<T> type)
marshalUnserializableParentback to summary
protected void marshalUnserializableParent(final HierarchicalStreamWriter writer, final MarshallingContext context, final Object replacedSource)
readFieldback to summary
private Object readField(ObjectStreamField field, Class<T> type, Object instance)
com.thoughtworks.xstream.converters.reflection back to summary

private Class SerializableConverter.UnserializableParentsReflectionProvider

extends ReflectionProviderWrapper
Class Inheritance

Field Summary

Inherited from com.thoughtworks.xstream.converters.reflection.ReflectionProviderWrapper:
wrapped

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
Inherited from com.thoughtworks.xstream.converters.reflection.ReflectionProviderWrapper:
fieldDefinedInClassgetFieldgetFieldOrNullgetFieldTypenewInstancewriteField

Constructor Detail

UnserializableParentsReflectionProviderback to summary
public UnserializableParentsReflectionProvider(final ReflectionProvider reflectionProvider)

Method Detail

visitSerializableFieldsback to summary
public void visitSerializableFields(final Object object, final ReflectionProvider.Visitor visitor)

Overrides com.thoughtworks.xstream.converters.reflection.ReflectionProviderWrapper.visitSerializableFields.

Implements com.thoughtworks.xstream.converters.reflection.ReflectionProvider.visitSerializableFields.