Top Description Methods
com.thoughtworks.xstream.converters

public Interface Converter

extends ConverterMatcher
Known Direct Implementers
com.thoughtworks.xstream.converters.SingleValueConverterWrapper, com.thoughtworks.xstream.converters.basic.CharConverter, com.thoughtworks.xstream.converters.basic.NullConverter, com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter, com.thoughtworks.xstream.converters.collections.BitSetConverter, com.thoughtworks.xstream.converters.collections.CharArrayConverter, com.thoughtworks.xstream.converters.collections.PropertiesConverter, com.thoughtworks.xstream.converters.enums.EnumConverter, com.thoughtworks.xstream.converters.enums.EnumSetConverter, com.thoughtworks.xstream.converters.extended.ActivationDataFlavorConverter, com.thoughtworks.xstream.converters.extended.AtomicBooleanConverter, com.thoughtworks.xstream.converters.extended.AtomicIntegerConverter, com.thoughtworks.xstream.converters.extended.AtomicLongConverter, com.thoughtworks.xstream.converters.extended.AtomicReferenceConverter, com.thoughtworks.xstream.converters.extended.ColorConverter, com.thoughtworks.xstream.converters.extended.DynamicProxyConverter, com.thoughtworks.xstream.converters.extended.EncodedByteArrayConverter, com.thoughtworks.xstream.converters.extended.FontConverter, com.thoughtworks.xstream.converters.extended.GregorianCalendarConverter, com.thoughtworks.xstream.converters.extended.JavaFieldConverter, com.thoughtworks.xstream.converters.extended.JavaMethodConverter, com.thoughtworks.xstream.converters.extended.NamedArrayConverter, com.thoughtworks.xstream.converters.extended.OptionalConverter, com.thoughtworks.xstream.converters.extended.OptionalDoubleConverter, com.thoughtworks.xstream.converters.extended.OptionalIntConverter, com.thoughtworks.xstream.converters.extended.OptionalLongConverter, com.thoughtworks.xstream.converters.extended.RegexPatternConverter, com.thoughtworks.xstream.converters.extended.ThrowableConverter, com.thoughtworks.xstream.converters.extended.ToAttributedValueConverter, com.thoughtworks.xstream.converters.javabean.JavaBeanConverter, com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter, com.thoughtworks.xstream.converters.reflection.ExternalizableConverter, com.thoughtworks.xstream.converters.time.SystemClockConverter, com.thoughtworks.xstream.converters.time.ValueRangeConverter, com.thoughtworks.xstream.converters.time.WeekFieldsConverter, com.thoughtworks.xstream.core.util.SelfStreamingInstanceChecker
Imports
com.thoughtworks.xstream.io.HierarchicalStreamReader, .HierarchicalStreamWriter

Converter implementations are responsible marshalling Java objects to/from textual data.

If an exception occurs during processing, a ConversionException should be thrown.

If working with the high level com.thoughtworks.xstream.XStream facade, you can register new converters using the XStream.registerConverter() method.

If working with the lower level API, the com.thoughtworks.xstream.converters.ConverterLookup implementation is responsible for looking up the appropriate converter.

Converters for object that can store all information in a single value should implement com.thoughtworks.xstream.converters.SingleValueConverter. com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter provides a starting point.

com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter provides a starting point for objects that hold a collection of other objects (such as Lists and Maps).

Author
Joe Walnes
See Also
com.thoughtworks.xstream.XStream, com.thoughtworks.xstream.converters.ConverterLookup, com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter, com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter

Method Summary

Modifier and TypeMethod and Description
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
)

Convert an object to textual data.

public Object

Returns:

The resulting object.
unmarshal
(HierarchicalStreamReader
The stream to read the text from.
reader
,
UnmarshallingContext context)

Convert textual data back into an object.

Inherited from com.thoughtworks.xstream.converters.ConverterMatcher:
canConvert

Method Detail

marshalback to summary
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context)

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)

Convert textual data back into an object.

Parameters
reader:HierarchicalStreamReader

The stream to read the text from.

Returns:Object

The resulting object.