Top Description Inners Fields Constructors Methods
com.thoughtworks.xstream.converters.enums

public Class EnumSetConverter

extends Object
implements Converter
Class Inheritance
All Implemented Interfaces
com.thoughtworks.xstream.converters.Converter, com.thoughtworks.xstream.converters.ConverterMatcher
Imports
com.thoughtworks.xstream.converters.ConversionException, .Converter, .MarshallingContext, .UnmarshallingContext, com.thoughtworks.xstream.io.HierarchicalStreamReader, .HierarchicalStreamWriter, com.thoughtworks.xstream.mapper.Mapper, com.thoughtworks.xstream.core.util.Fields, java.lang.reflect.Field, java.util.EnumSet, .Iterator

Serializes a Java 5 EnumSet. If a SecurityManager is set, the converter will only work with permissions for SecurityManager.checkPackageAccess, SecurityManager.checkMemberAccess(this, EnumSet.MEMBER) and ReflectPermission("suppressAccessChecks").
Authors
Joe Walnes, Jörg Schaible

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final Mapper

Constructor Summary

AccessConstructor and Description
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 String
joinEnumValues(EnumSet<E extends Enum<E>> set)

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

mapperback to summary
private final Mapper mapper

Constructor Detail

EnumSetConverterback to summary
public EnumSetConverter(Mapper mapper)

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

joinEnumValuesback to summary
private String joinEnumValues(EnumSet<E extends Enum<E>> set)
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.

Annotations
@SuppressWarnings:unchecked
com.thoughtworks.xstream.converters.enums back to summary

private Class EnumSetConverter.Reflections

extends Object
Class Inheritance
  • java.lang.Object
  • com.thoughtworks.xstream.converters.enums.EnumSetConverter.Reflections

Field Summary

Modifier and TypeField and Description
private static final Field

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

typeFieldback to summary
private static final Field typeField

Constructor Detail

Reflectionsback to summary
private Reflections()