Interface Converter
-
- All Superinterfaces:
ConverterMatcher
- All Known Implementing Classes:
AbstractCollectionConverter,AbstractReflectionConverter,ActivationDataFlavorConverter,AnnotationReflectionConverter,ArrayConverter,AtomicBooleanConverter,AtomicIntegerConverter,AtomicLongConverter,AtomicReferenceConverter,BitSetConverter,CGLIBEnhancedConverter,CharArrayConverter,CharConverter,CollectionConverter,ColorConverter,DynamicProxyConverter,EncodedByteArrayConverter,EnumConverter,EnumMapConverter,EnumSetConverter,ExternalizableConverter,FontConverter,GregorianCalendarConverter,JavaBeanConverter,JavaFieldConverter,JavaMethodConverter,LambdaConverter,LookAndFeelConverter,MapConverter,NamedArrayConverter,NamedCollectionConverter,NamedMapConverter,NullConverter,OptionalConverter,OptionalDoubleConverter,OptionalIntConverter,OptionalLongConverter,PropertiesConverter,ReflectionConverter,RegexPatternConverter,SelfStreamingInstanceChecker,SelfStreamingInstanceChecker,SerializableConverter,SingletonCollectionConverter,SingletonMapConverter,SingleValueConverterWrapper,SubjectConverter,SystemClockConverter,ThrowableConverter,ToAttributedValueConverter,TreeMapConverter,TreeSetConverter,ValueRangeConverter,WeakHashMapConverter,WeekFieldsConverter
public interface Converter extends ConverterMatcher
Converter implementations are responsible marshalling Java objects to/from textual data.If an exception occurs during processing, a
ConversionExceptionshould be thrown.If working with the high level
XStreamfacade, you can register new converters using the XStream.registerConverter() method.If working with the lower level API, the
ConverterLookupimplementation is responsible for looking up the appropriate converter.Converters for object that can store all information in a single value should implement
SingleValueConverter.AbstractSingleValueConverterprovides a starting point.AbstractCollectionConverterprovides a starting point for objects that hold a collection of other objects (such as Lists and Maps).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidmarshal(java.lang.Object source, HierarchicalStreamWriter writer, MarshallingContext context)Convert an object to textual data.java.lang.Objectunmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)Convert textual data back into an object.-
Methods inherited from interface com.thoughtworks.xstream.converters.ConverterMatcher
canConvert
-
-
-
-
Method Detail
-
marshal
void marshal(java.lang.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.
-
unmarshal
java.lang.Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
Convert textual data back into an object.- Parameters:
reader- The stream to read the text from.context-- Returns:
- The resulting object.
-
-