Class SerializableConverter
java.lang.Object
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
com.thoughtworks.xstream.converters.reflection.SerializableConverter
- All Implemented Interfaces:
Converter
,ConverterMatcher
,Caching
- Direct Known Subclasses:
CGLIBEnhancedConverter
,LambdaConverter
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
- readObject(), writeObject()
- class inheritance
- readResolve(), writeReplace()
- getFields(), putFields(), writeFields(), readFields()
- ObjectStreamField[] serialPersistentFields
- ObjectInputValidation
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
Nested classes/interfaces inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
AbstractReflectionConverter.DuplicateFieldException, AbstractReflectionConverter.UnknownFieldException
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate 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
Fields inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
mapper, reflectionProvider, serializationMembers, serializationMethodInvoker
-
Constructor Summary
ConstructorsConstructorDescriptionSerializableConverter
(Mapper mapper, ReflectionProvider reflectionProvider) Deprecated.SerializableConverter
(Mapper mapper, ReflectionProvider reflectionProvider, ClassLoaderReference classLoaderReference) Construct a SerializableConverter.SerializableConverter
(Mapper mapper, ReflectionProvider reflectionProvider, ClassLoader classLoader) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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) doUnmarshal
(Object result, HierarchicalStreamReader reader, UnmarshallingContext context) protected Object
doUnmarshalConditionally
(Object result, HierarchicalStreamReader reader, UnmarshallingContext context) protected List
hierarchyFor
(Class type) private boolean
isSerializable
(Class type) protected void
marshalUnserializableParent
(HierarchicalStreamWriter writer, MarshallingContext context, Object replacedSource) private Object
readField
(ObjectStreamField field, Class type, Object instance) Methods inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
canAccess, flushCache, instantiateNewInstance, marshal, marshallField, readResolve, shouldUnmarshalField, shouldUnmarshalTransientFields, unmarshal, unmarshallField
-
Field Details
-
ELEMENT_NULL
- See Also:
-
ELEMENT_DEFAULT
- See Also:
-
ELEMENT_UNSERIALIZABLE_PARENTS
- See Also:
-
ATTRIBUTE_CLASS
- See Also:
-
ATTRIBUTE_SERIALIZATION
- See Also:
-
ATTRIBUTE_VALUE_CUSTOM
- See Also:
-
ELEMENT_FIELDS
- See Also:
-
ELEMENT_FIELD
- See Also:
-
ATTRIBUTE_NAME
- See Also:
-
classLoaderReference
-
-
Constructor Details
-
SerializableConverter
public SerializableConverter(Mapper mapper, ReflectionProvider reflectionProvider, ClassLoaderReference classLoaderReference) Construct a SerializableConverter.- Parameters:
mapper
- the mapper chain instancereflectionProvider
- the reflection providerclassLoaderReference
- the reference to theClassLoader
of the XStream instance- Since:
- 1.4.5
-
SerializableConverter
public SerializableConverter(Mapper mapper, ReflectionProvider reflectionProvider, ClassLoader classLoader) Deprecated. -
SerializableConverter
Deprecated.
-
-
Method Details
-
canConvert
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
-
isSerializable
-
doMarshal
- Overrides:
doMarshal
in classAbstractReflectionConverter
-
marshalUnserializableParent
protected void marshalUnserializableParent(HierarchicalStreamWriter writer, MarshallingContext context, Object replacedSource) -
readField
-
hierarchyFor
-
doUnmarshal
public Object doUnmarshal(Object result, HierarchicalStreamReader reader, UnmarshallingContext context) - Overrides:
doUnmarshal
in classAbstractReflectionConverter
-
doMarshalConditionally
protected void doMarshalConditionally(Object source, HierarchicalStreamWriter writer, MarshallingContext context) -
doUnmarshalConditionally
protected Object doUnmarshalConditionally(Object result, HierarchicalStreamReader reader, UnmarshallingContext context)
-
SerializableConverter(Mapper, ReflectionProvider, ClassLoaderReference)