Top Description Fields Constructors Methods
com.thoughtworks.xstream.core.util

public Class SelfStreamingInstanceChecker

extends Object
implements Converter
Class Inheritance
All Implemented Interfaces
com.thoughtworks.xstream.converters.Converter, com.thoughtworks.xstream.converters.ConverterMatcher
Known Direct Subclasses
com.thoughtworks.xstream.converters.reflection.SelfStreamingInstanceChecker
Imports
com.thoughtworks.xstream.converters.ConversionException, .Converter, .ConverterLookup, .MarshallingContext, .UnmarshallingContext, com.thoughtworks.xstream.io.HierarchicalStreamReader, .HierarchicalStreamWriter

A special converter that prevents self-serialization. The serializing XStream instance adds a converter of this type to prevent self-serialization and will throw an exception instead.
Author
Jörg Schaible
Since
1.2

Field Summary

Modifier and TypeField and Description
private Converter
private final ConverterLookup
private final Object

Constructor Summary

AccessConstructor and Description
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.
private Converter
public void
marshal(Object
The object to be marshalled.
source
,
HierarchicalStreamWriter
A stream to write to.
writer
,
MarshallingContext
A context that allows nested objects to be processed by XStream.
context
)

Implements com.thoughtworks.xstream.converters.Converter.marshal.

Convert an object to textual data.
public Object
unmarshal(HierarchicalStreamReader
The stream to read the text from.
reader
,
UnmarshallingContext context)

Implements com.thoughtworks.xstream.converters.Converter.unmarshal.

Convert textual data back into an object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultConverterback to summary
private Converter defaultConverter
lookupback to summary
private final ConverterLookup lookup
selfback to summary
private final Object self

Constructor Detail

SelfStreamingInstanceCheckerback to summary
public SelfStreamingInstanceChecker(ConverterLookup lookup, Object xstream)
Since
1.4.5
SelfStreamingInstanceCheckerback to summary
public SelfStreamingInstanceChecker(Converter defaultConverter, Object xstream)

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

getConverterback to summary
private Converter getConverter()
marshalback to summary
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context)

Implements com.thoughtworks.xstream.converters.Converter.marshal.

Doc from com.thoughtworks.xstream.converters.Converter.marshal.

Convert an object to textual data.

Parameters
source:Object

The object to be marshalled.

writer:HierarchicalStreamWriter

A stream to write to.

context:MarshallingContext

A context that allows nested objects to be processed by XStream.

unmarshalback to summary
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)

Implements com.thoughtworks.xstream.converters.Converter.unmarshal.

Doc from com.thoughtworks.xstream.converters.Converter.unmarshal.

Convert textual data back into an object.

Parameters
reader:HierarchicalStreamReader

The stream to read the text from.

Returns:Object

The resulting object.