Class DeferredCodec<T>

java.lang.Object
com.hypixel.hytale.codec.lookup.DeferredCodec<T>
Type Parameters:
T - the type the value decodes to
All Implemented Interfaces:
Codec<Deferred<T>>, RawJsonCodec<Deferred<T>>, SchemaConvertable<Deferred<T>>, WrappedCodec<T>

public class DeferredCodec<T> extends Object implements Codec<Deferred<T>>, WrappedCodec<T>
Reads a value into a Deferred rather than decoding it. This lets the codec for its type be registered after the file that names it was read.

The schema is that of the codec it wraps, so a key that defers its decode still documents every type it accepts.

A value read from JSON is held as BSON and later decoded from that BSON. A field codec that accepts a JSON form its BSON decode does not, such as a base64 string for binary, fails once deferred. Register only types whose fields decode from both forms.