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

public Class PropertiesConverter

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

Special converter for java.util.Properties that stores properties in a more compact form than java.util.Map.

Because all entries of a Properties instance are Strings, a single element is used for each property with two attributes; one for key and one for value.

Additionally, default properties are also serialized, if they are present or if a SecurityManager is set, and it has permissions for SecurityManager.checkPackageAccess, SecurityManager.checkMemberAccess(this, EnumSet.MEMBER) and ReflectPermission("suppressAccessChecks").

Authors
Joe Walnes, Kevin Ring

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final boolean

Constructor Summary

AccessConstructor and Description
public
public
PropertiesConverter(boolean sort)

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.
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

sortback to summary
private final boolean sort

Constructor Detail

PropertiesConverterback to summary
public PropertiesConverter()
PropertiesConverterback to summary
public PropertiesConverter(boolean sort)

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

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.

com.thoughtworks.xstream.converters.collections back to summary

private Class PropertiesConverter.Reflections

extends Object
Class Inheritance
  • java.lang.Object
  • com.thoughtworks.xstream.converters.collections.PropertiesConverter.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

defaultsFieldback to summary
private static final Field defaultsField

Constructor Detail

Reflectionsback to summary
private Reflections()