Top Description Fields Constructors Methods
com.thoughtworks.xstream.mapper

public Class ImmutableTypesMapper

extends MapperWrapper
Class Inheritance
Imports
java.util.HashSet, .Set

Mapper that specifies which types are basic immutable types. Types that are marked as immutable will be written multiple times in the serialization stream without using references.

Note, that an already persisted stream might still contain references for immutable types. They can be dereferenced at deserialization time, unless the type is explicitly declared as unreferenceable. However, this is only possible at the expense of memory book-keeping all instances.

Author
Joe Walnes

Field Summary

Modifier and TypeField and Description
private final Set<E>
private final Set<E>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addImmutableType(Class<T> type)

Deprecated As of 1.4.9 use addImmutableType(Class, boolean)
public void
addImmutableType(final Class<T>
the immutable type
type
,
final boolean
flag for possible references
isReferenceable
)

Declare a type as immutable.

public boolean
isImmutableValueType(Class<T> type)

Overrides com.thoughtworks.xstream.mapper.MapperWrapper.isImmutableValueType.

Implements com.thoughtworks.xstream.mapper.Mapper.isImmutableValueType.

Whether this type is a simple immutable value (int, boolean, String, URL, etc).
public boolean
Inherited from com.thoughtworks.xstream.mapper.MapperWrapper:
aliasForAttributealiasForAttributealiasForSystemAttributeattributeForAliasattributeForAliasdefaultImplementationOfgetConverterFromAttributegetConverterFromAttributegetConverterFromAttributegetConverterFromItemTypegetConverterFromItemTypegetConverterFromItemTypegetFieldNameForItemTypeAndNamegetImplicitCollectionDefForFieldNamegetItemTypeForItemFieldNamegetLocalConverterisIgnoredElementlookupMapperOfTyperealClassrealMemberserializedClassserializedMembershouldSerializeMember

Field Detail

immutableTypesback to summary
private final Set<E> immutableTypes
unreferenceableTypesback to summary
private final Set<E> unreferenceableTypes

Constructor Detail

ImmutableTypesMapperback to summary
public ImmutableTypesMapper(Mapper wrapped)

Method Detail

addImmutableTypeback to summary
public void addImmutableType(Class<T> type)

Deprecated

As of 1.4.9 use addImmutableType(Class, boolean)

addImmutableTypeback to summary
public void addImmutableType(final Class<T> type, final boolean isReferenceable)

Declare a type as immutable.

Parameters
type:Class<T>

the immutable type

isReferenceable:boolean

flag for possible references

Since
1.4.9
isImmutableValueTypeback to summary
public boolean isImmutableValueType(Class<T> type)

Overrides com.thoughtworks.xstream.mapper.MapperWrapper.isImmutableValueType.

Implements com.thoughtworks.xstream.mapper.Mapper.isImmutableValueType.

Doc from com.thoughtworks.xstream.mapper.Mapper.isImmutableValueType.

Whether this type is a simple immutable value (int, boolean, String, URL, etc). Immutable types will be repeatedly written in the serialized stream, instead of using object references.

isReferenceableback to summary
public boolean isReferenceable(final Class<T> type)

Overrides com.thoughtworks.xstream.mapper.MapperWrapper.isReferenceable.

Implements com.thoughtworks.xstream.mapper.Mapper.isReferenceable.

Doc from com.thoughtworks.xstream.mapper.Mapper.isReferenceable.

Whether this type is referenceable in a stream.