Static
aliasesMaps from classnames to codec names.
Static
codecsStatic
addStatic
getReturns a codec that handles objects that are constructed using the given constructor or a codec registered under the provided name.
When passing a name, the method first check if an alias exists for the name, and if so, it uses it to retrieve the codec.
If there is no registered Codec, the method tries to register a new Codec using the provided constructor.
JavaScript constructor function of the Codec or Codec name.
Static
getFirst try to get the codec by the name it is registered with. If it doesn't exist, use the alias eventually declared to get the codec.
the name of the codec that is willing to be retrieved.
Static
registerRegisters a new codec and associates the name of the codec via ObjectCodec.getName with the codec object.
ObjectCodec to be registered.
if true
, register an alias if the codec name doesn't match the name of the constructor of ObjectCodec.template.
Singleton class that acts as a global registry for codecs.
Adding a Codec
Define a default codec with a new instance of the object to be handled.
Define the functions required for encoding and decoding objects.
Register the codec in the CodecRegistry.
ObjectCodec.decode may be used to either create a new instance of an object or to configure an existing instance, in which case the into argument points to the existing object. In this case, we say the codec "configures" the object.