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.
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.