Package com.thoughtworks.xstream.mapper
Class ImmutableTypesMapper
- java.lang.Object
-
- com.thoughtworks.xstream.mapper.MapperWrapper
-
- com.thoughtworks.xstream.mapper.ImmutableTypesMapper
-
- All Implemented Interfaces:
Mapper
public class ImmutableTypesMapper extends MapperWrapper
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.thoughtworks.xstream.mapper.Mapper
Mapper.ImplicitCollectionMapping, Mapper.Null
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.SetimmutableTypesprivate java.util.SetunreferenceableTypes
-
Constructor Summary
Constructors Constructor Description ImmutableTypesMapper(Mapper wrapped)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddImmutableType(java.lang.Class type)Deprecated.As of 1.4.9 useaddImmutableType(Class, boolean)voidaddImmutableType(java.lang.Class type, boolean isReferenceable)Declare a type as immutable.booleanisImmutableValueType(java.lang.Class type)Whether this type is a simple immutable value (int, boolean, String, URL, etc).booleanisReferenceable(java.lang.Class type)Whether this type is referenceable in a stream.-
Methods inherited from class com.thoughtworks.xstream.mapper.MapperWrapper
aliasForAttribute, aliasForAttribute, aliasForSystemAttribute, attributeForAlias, attributeForAlias, defaultImplementationOf, getConverterFromAttribute, getConverterFromAttribute, getConverterFromAttribute, getConverterFromItemType, getConverterFromItemType, getConverterFromItemType, getFieldNameForItemTypeAndName, getImplicitCollectionDefForFieldName, getItemTypeForItemFieldName, getLocalConverter, isIgnoredElement, lookupMapperOfType, realClass, realMember, serializedClass, serializedMember, shouldSerializeMember
-
-
-
-
Constructor Detail
-
ImmutableTypesMapper
public ImmutableTypesMapper(Mapper wrapped)
-
-
Method Detail
-
addImmutableType
public void addImmutableType(java.lang.Class type)
Deprecated.As of 1.4.9 useaddImmutableType(Class, boolean)
-
addImmutableType
public void addImmutableType(java.lang.Class type, boolean isReferenceable)Declare a type as immutable.- Parameters:
type- the immutable typeisReferenceable- flag for possible references- Since:
- 1.4.9
-
isImmutableValueType
public boolean isImmutableValueType(java.lang.Class type)
Description copied from interface:MapperWhether 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.- Specified by:
isImmutableValueTypein interfaceMapper- Overrides:
isImmutableValueTypein classMapperWrapper
-
isReferenceable
public boolean isReferenceable(java.lang.Class type)
Description copied from interface:MapperWhether this type is referenceable in a stream.- Specified by:
isReferenceablein interfaceMapper- Overrides:
isReferenceablein classMapperWrapper
-
-