public final class CodecRegistryHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> CodecRegistry |
fromCodec(Codec<T> codec)
Creates a codec registry from the provided codec
|
static CodecRegistry |
fromProvider(CodecProvider codecProvider)
A codec registry that uses a single codec provider when looking for codecs.
|
static CodecRegistry |
fromProviders(List<CodecProvider> codecProviders)
A codec registry that contains a list of providers to use when looking for codecs.
|
static CodecRegistry |
fromRegistries(CodecRegistry firstRegistry,
CodecRegistry secondRegistry)
A codec registry that compounds two registries.
|
public static <T> CodecRegistry fromCodec(Codec<T> codec)
This registry can then be used alongside other registries. Typically used when adding extra codecs to existing codecs with the
fromRegistries(CodecRegistry, CodecRegistry) helper.
T - the value type of the codeccodec - the codec to create a registry forpublic static CodecRegistry fromProvider(CodecProvider codecProvider)
codecProvider - the codec providerpublic static CodecRegistry fromProviders(List<CodecProvider> codecProviders)
codecProviders - the list of codec providerspublic static CodecRegistry fromRegistries(CodecRegistry firstRegistry, CodecRegistry secondRegistry)
The first registry is checked first then if that returns null the second registry is checked.
firstRegistry - the preferred registry for codec lookupssecondRegistry - the fallback registry for codec lookups.