com.r3corda.core.serialization / SerializeAsTokenContext / <init>

<init>

SerializeAsTokenContext(toBeTokenized: Any, kryo: <ERROR CLASS> = createKryo())

A context for mapping SerializationTokens to/from SerializeAsTokens.

A context is initialised with an object containing all the instances of SerializeAsToken to eagerly register all the tokens. In our case this can be the ServiceHub.

Then it is a case of using the companion object methods on SerializeAsTokenSerializer to set and clear context as necessary on the Kryo instance when serializing to enable/disable tokenization.