public interface

Converter

implements ConverterMatcher
com.thoughtworks.xstream.converters.Converter
Known Indirect Subclasses

Class Overview

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 XStream facade, you can register new converters using the XStream.registerConverter() method.

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

Converters for object that can store all information in a single value should implement SingleValueConverter.

AbstractSingleValueConverter provides a starting point.

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

Summary

Public Methods
abstract void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context)
Convert an object to textual data.
abstract Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
Convert textual data back into an object.
[Expand]
Inherited Methods
From interface com.thoughtworks.xstream.converters.ConverterMatcher

Public Methods

public abstract void marshal (Object source, HierarchicalStreamWriter writer, MarshallingContext context)

Convert an object to textual data.

Parameters
source The object to be marshalled.
writer A stream to write to.
context A context that allows nested objects to be processed by XStream.

public abstract Object unmarshal (HierarchicalStreamReader reader, UnmarshallingContext context)

Convert textual data back into an object.

Parameters
reader The stream to read the text from.
Returns
  • The resulting object.