net.corda.core.serialization

## Class SerializeAsTokenContext

- net.corda.core.serialization.SerializeAsTokenContext

-     public class SerializeAsTokenContext

  A context for mapping SerializationTokens to/from SerializeAsTokens.

  A context is initialised with an object containing all the instances of `interface 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 `class SerializeAsTokenSerializer` to set and clear context as necessary on the Kryo instance when serializing to enable/disable tokenization.

  See Also:
    `interface SerializeAsToken`, ServiceHub, `class SerializeAsTokenSerializer`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SerializeAsTokenContext(java.lang.Object toBeTokenized, com.esotericsoftware.kryo.Kryo kryo)` A context for mapping SerializationTokens to/from SerializeAsTokens.

- - ### Constructor Detail

    - #### SerializeAsTokenContext

          public SerializeAsTokenContext(java.lang.Object toBeTokenized,
                                         com.esotericsoftware.kryo.Kryo kryo)

      A context for mapping SerializationTokens to/from SerializeAsTokens.

      A context is initialised with an object containing all the instances of `interface 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 `class SerializeAsTokenSerializer` to set and clear context as necessary on the Kryo instance when serializing to enable/disable tokenization.

      See Also:
        `interface SerializeAsToken`, ServiceHub, `class SerializeAsTokenSerializer`