public class TrackingTypeArchiverCollection extends Object implements IFreezable
TrackingTypeArchivers
. It is safe to
use all methods of this class from multiple threads simultaneously.Constructor and Description |
---|
TrackingTypeArchiverCollection()
Initializes a new instance.
|
TrackingTypeArchiverCollection(Map<Class<?>,TrackingTypeArchiver> archivers)
Initializes a new instance with a collection of
TrackingTypeArchivers . |
TrackingTypeArchiverCollection(TrackingTypeArchiverCollection collection)
Initializes a new instance as a copy of an existing instance.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Class<?> type,
TrackingTypeArchiver archiver)
Adds an archiver for a complex type composed of multiple primitives.
|
<T> void |
addEnumeration(TypeLiteral<T> typeLiteralT)
Adds an archiver for an enumeration type that should be archived directly.
|
void |
freeze()
Freezes this object.
|
TrackingTypeArchiver |
getArchiverForType(Class<?> type)
Gets the archiver for the specified type.
|
boolean |
getIsFrozen()
Gets a value indicating whether this object is frozen.
|
public TrackingTypeArchiverCollection()
TrackingTypeArchivers
for all primitive types.public TrackingTypeArchiverCollection(@Nonnull TrackingTypeArchiverCollection collection)
collection
- The existing instance to copy.ArgumentNullException
- Thrown when collection
is null
.public TrackingTypeArchiverCollection(@Nonnull Map<Class<?>,TrackingTypeArchiver> archivers)
TrackingTypeArchivers
.archivers
- The collection of archivers.ArgumentNullException
- Thrown when archivers
is null
.public final <T> void addEnumeration(TypeLiteral<T> typeLiteralT)
T
- The enumeration type to archive directly.typeLiteralT
- A TypeLiteral object representing the generic type T
.public final void add(@Nonnull Class<?> type, @Nonnull TrackingTypeArchiver archiver)
type
- The type for which to add an archiver.archiver
- The archiver for the type.ArgumentNullException
- Thrown when type
or archiver
is null
.@Nonnull public final TrackingTypeArchiver getArchiverForType(@Nonnull Class<?> type)
type
- The type for which to obtain an archiver.IllegalStateException
- Thrown when no archiver is registered for the specified type.ArgumentNullException
- Thrown when type
is null
.public final void freeze()
ObjectFrozenException
.freeze
in interface IFreezable
public final boolean getIsFrozen()
ObjectFrozenException
will be thrown if an attempt is made to do so.getIsFrozen
in interface IFreezable