-
Language:
English
-
Language:
English
6.3.3. Linking Externalizers with Marshaller Classes
The Externalizer's
readObject()
and writeObject()
methods link with the type classes they are configured to externalize by providing a getTypeClasses()
implementation.
For example:
import org.infinispan.util.Util; ... @Override public Set<Class<? extends ReplicableCommand>> getTypeClasses() { return Util.asSet(LockControlCommand.class, RehashControlCommand.class, StateTransferControlCommand.class, GetKeyValueCommand.class, ClusteredGetCommand.class, MultipleRpcCommand.class, SingleRpcCommand.class, CommitCommand.class, PrepareCommand.class, RollbackCommand.class, ClearCommand.class, EvictCommand.class, InvalidateCommand.class, InvalidateL1Command.class, PutKeyValueCommand.class, PutMapCommand.class, RemoveCommand.class, ReplaceCommand.class); }
In the provided example, ReplicableCommandExternalizer indicates that it can externalize multiple commands.
There can be instances where the class instance to be externalized cannot be referenced because the source code is not available or cannot be modified. In this case, users can attempt to look up the class using the fully qualified class name. For example:
@Override public Set<Class<? extends List>> getTypeClasses() { return Util.<Class<? extends List>>asSet( Util.loadClass("java.util.Collections$SingletonList")); }