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 classNested classes/interfaces inherited from class AbstractReflectionConverter
AbstractReflectionConverter.DuplicateFieldException, AbstractReflectionConverter.UnknownFieldException -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate final ClassLoaderReferenceprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final StringFields inherited from class 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 TypeMethodDescriptionbooleancanConvert(Class type) Determines whether the converter can marshall a particular type.voiddoMarshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) protected voiddoMarshalConditionally(Object source, HierarchicalStreamWriter writer, MarshallingContext context) doUnmarshal(Object result, HierarchicalStreamReader reader, UnmarshallingContext context) protected ObjectdoUnmarshalConditionally(Object result, HierarchicalStreamReader reader, UnmarshallingContext context) protected ListhierarchyFor(Class type) private booleanisSerializable(Class type) protected voidmarshalUnserializableParent(HierarchicalStreamWriter writer, MarshallingContext context, Object replacedSource) private ObjectreadField(ObjectStreamField field, Class type, Object instance) Methods inherited from class 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 theClassLoaderof 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:ConverterMatcherDetermines whether the converter can marshall a particular type.- Parameters:
type- the Class representing the object type to be converted
-
isSerializable
-
doMarshal
- Overrides:
doMarshalin classAbstractReflectionConverter
-
marshalUnserializableParent
protected void marshalUnserializableParent(HierarchicalStreamWriter writer, MarshallingContext context, Object replacedSource) -
readField
-
hierarchyFor
-
doUnmarshal
public Object doUnmarshal(Object result, HierarchicalStreamReader reader, UnmarshallingContext context) - Overrides:
doUnmarshalin 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)