A TypeHandler is responsible for marshalling/unmarshalling Objects to and from JSON. Typically, in JavaScript, this is not necessary, however, in the case of Coherence, it has specific requirements when mapping objects between languages.

Specifically, this revolves around @class metadata as the first property of a JSON object. This @class metadata is an alias for a type that is known to Coherence. When Coherence serializes a type, it populates the @class metadata with the type alias name, which can be used to reconstruct the Java class running in another VM, or in our case reconstruct a similar object in Javascript. Using 1BigInt` as an example; using a TypeHandler the BigInt can be deserialized to JSON in the required fashion in order to have a BigInteger created in Coherence and vice-versa.

Hierarchy

  • TypeHandler

Constructors

Properties

Accessors

Methods

Constructors

  • Protected

    Constructs a new TypeHandler.

    Parameters

    • type: any

      the type alias for the Java Type managed by Coherence.

    Returns TypeHandler

Properties

_type: string

Accessors

  • get type(): string
  • Returns the type alias.

    Returns string

Methods

  • Used during serialization of a graph to determine if the Javascript type is handled by this TypeHandler.

    Parameters

    • object: any

      the type to verify

    Returns boolean

  • Deconstructs a specific JavaScript object to a JSON format that can be used by Coherence to recreate a Java object.

    Parameters

    • object: any

      being serialized

    Returns any

  • Reconstitutes a specific JavaScript object from JSON.

    Parameters

    • object: any

      the object being deserialized

    Returns any