Package com.thoughtworks.xstream.mapper
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 com.thoughtworks.xstream.mapper.Mapper
Mapper.ImplicitCollectionMapping, Mapper.Null
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addImmutableType
(Class type) Deprecated.void
addImmutableType
(Class type, boolean isReferenceable) Declare a type as immutable.boolean
isImmutableValueType
(Class type) Whether this type is a simple immutable value (int, boolean, String, URL, etc).boolean
isReferenceable
(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
-
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:Mapper
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.- Specified by:
isImmutableValueType
in interfaceMapper
- Overrides:
isImmutableValueType
in classMapperWrapper
-
isReferenceable
Description copied from interface:Mapper
Whether this type is referenceable in a stream.- Specified by:
isReferenceable
in interfaceMapper
- Overrides:
isReferenceable
in classMapperWrapper
-
addImmutableType(Class, boolean)