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