public final class CodecRegistries
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static CodecRegistry |
fromCodecs(Codec<?>... codecs)
Creates a
CodecRegistry from the provided list of Codec instances. |
static CodecRegistry |
fromCodecs(java.util.List<? extends Codec<?>> codecs)
Creates a
CodecRegistry from the provided list of Codec instances. |
static CodecRegistry |
fromProviders(CodecProvider... providers)
Creates a
CodecRegistry from the provided list of CodecProvider instances. |
static CodecRegistry |
fromProviders(java.util.List<? extends CodecProvider> providers)
Creates a
CodecRegistry from the provided list of CodecProvider instances. |
static CodecRegistry |
fromRegistries(CodecRegistry... registries)
A
CodecRegistry that combines the given CodecRegistry instances into a single registry. |
static CodecRegistry |
fromRegistries(java.util.List<? extends CodecRegistry> registries)
A
CodecRegistry that combines the given CodecRegistry instances into a single registry. |
public static CodecRegistry fromCodecs(Codec<?>... codecs)
CodecRegistry
from the provided list of Codec
instances.
This registry can then be used alongside other registries. Typically used when adding extra codecs to existing codecs with the
fromRegistries(CodecRegistry...)
)} helper.
codecs
- the Codec
to create a registry forCodecRegistry
for the given list of Codec
instances.public static CodecRegistry fromCodecs(java.util.List<? extends Codec<?>> codecs)
CodecRegistry
from the provided list of Codec
instances.
This registry can then be used alongside other registries. Typically used when adding extra codecs to existing codecs with the
fromRegistries(CodecRegistry...)
)} helper.
codecs
- the Codec
to create a registry forCodecRegistry
for the given list of Codec
instances.public static CodecRegistry fromProviders(CodecProvider... providers)
CodecRegistry
from the provided list of CodecProvider
instances.
The created instance can handle cycles of Codec
dependencies, i.e when the construction of a Codec
for class A
requires the construction of a Codec
for class B, and vice versa.
providers
- the codec providerCodecRegistry
with the ordered list of CodecProvider
instances. The registry is also guaranteed to be an
instance of {code CodecProvider}, so that when one is passed to fromRegistries(CodecRegistry...)
or fromRegistries(java.util.List)
it will be treated as a CodecProvider
and properly resolve any dependencies between
registries.public static CodecRegistry fromProviders(java.util.List<? extends CodecProvider> providers)
CodecRegistry
from the provided list of CodecProvider
instances.
The created instance can handle cycles of Codec
dependencies, i.e when the construction of a Codec
for class A
requires the construction of a Codec
for class B, and vice versa.
providers
- the codec providerCodecRegistry
with the ordered list of CodecProvider
instances. The registry is also guaranteed to be an
instance of {code CodecProvider}, so that when one is passed to fromRegistries(CodecRegistry...)
or fromRegistries(java.util.List)
it will be treated as a CodecProvider
and properly resolve any dependencies between
registries.public static CodecRegistry fromRegistries(CodecRegistry... registries)
CodecRegistry
that combines the given CodecRegistry
instances into a single registry.
The registries are checked in order until one returns a Codec
for the requested Class
.
The created instance can handle cycles of Codec
dependencies, i.e when the construction of a Codec
for class A
requires the construction of a Codec
for class B, and vice versa.
Any of the given registries that also implement CodecProvider
will be treated as a CodecProvider
instead of a
CodecRegistry
, which will ensure proper resolution of any dependencies between registries.
registries
- the preferred registry for Codec
lookupsCodecRegistry
that combines the list of CodecRegistry
instances into a single onepublic static CodecRegistry fromRegistries(java.util.List<? extends CodecRegistry> registries)
CodecRegistry
that combines the given CodecRegistry
instances into a single registry.
The registries are checked in order until one returns a Codec
for the requested Class
.
The created instance can handle cycles of Codec
dependencies, i.e when the construction of a Codec
for class A
requires the construction of a Codec
for class B, and vice versa.
Any of the given registries that also implement CodecProvider
will be treated as a CodecProvider
instead of a
CodecRegistry
, which will ensure proper resolution of any dependencies between registries.
registries
- the preferred registry for Codec
lookupsCodecRegistry
that combines the list of CodecRegistry
instances into a single one