T
- the type of marshaller, implementing this interfacepublic interface StatefulCopyable<T extends StatefulCopyable<T>>
Cloneable
-like interface used by Chronicle Map to populate stateful serializer
implementations for each isolated site (thread + Chronicle Map instance + objects domain).
Stateful implementations of serialization interfaces (SizedReader
, SizedWriter
,
BytesReader
, BytesWriter
or DataAccess
), configured for ChronicleMap
or ChronicleSet
in builder, should implement the StatefulCopyable
interface.
See
Understanding StatefulCopyable
section in the Chronicle Map tutorial for more info
on how to implement and use this interface properly, and for examples.
Modifier and Type | Method and Description |
---|---|
T |
copy()
Creates a copy of this marshaller, with independent state.
|
static <T> T |
copyIfNeeded(T possiblyStatefulCopyable)
Checks if
possiblyStatefulCopyable implements StatefulCopyable , then returns
copy() of it, otherwise returns the possiblyStatefulCopyable itself. |
static <T> T copyIfNeeded(T possiblyStatefulCopyable)
possiblyStatefulCopyable
implements StatefulCopyable
, then returns
copy()
of it, otherwise returns the possiblyStatefulCopyable
itself.T
- the type of the passed instancepossiblyStatefulCopyable
- the instance to copy()
if it implements StatefulCopyable
, or to return without modificationStatefulCopyable
T copy()
copy()
is called, should be inherited in the copy (e. g. the class of objects
serialized). So, copy()
should be transitive, i. e. marshaller.copy()
and
marshaller.copy().copy()
should result to identical instances.
The state of the instance on which copy()
is called shouldn't be changed.
If some marshaller is ought to implement StatefulCopyable
interface (e. g.
DataAccess
) but is stateless actually, it could return this
from this method.
Copyright © 2020. All rights reserved.