Class CodecRegistries
- Since:
- 3.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic CodecRegistry
fromCodecs
(List<? extends Codec<?>> codecs) Creates aCodecRegistry
from the provided list ofCodec
instances.static CodecRegistry
fromCodecs
(Codec<?>... codecs) Creates aCodecRegistry
from the provided list ofCodec
instances.static CodecRegistry
fromProviders
(List<? extends CodecProvider> providers) Creates aCodecRegistry
from the provided list ofCodecProvider
instances.static CodecRegistry
fromProviders
(CodecProvider... providers) Creates aCodecRegistry
from the provided list ofCodecProvider
instances.static CodecRegistry
fromRegistries
(List<? extends CodecRegistry> registries) ACodecRegistry
that combines the givenCodecRegistry
instances into a single registry.static CodecRegistry
fromRegistries
(CodecRegistry... registries) ACodecRegistry
that combines the givenCodecRegistry
instances into a single registry.static CodecRegistry
withUuidRepresentation
(CodecRegistry codecRegistry, UuidRepresentation uuidRepresentation) Apply givenUuidRepresentation
to the givenCodecRegistry
.
-
Method Details
-
withUuidRepresentation
public static CodecRegistry withUuidRepresentation(CodecRegistry codecRegistry, UuidRepresentation uuidRepresentation) Apply givenUuidRepresentation
to the givenCodecRegistry
.- Parameters:
codecRegistry
- the code registryuuidRepresentation
- the uuid representation- Returns:
- a
CodecRegistry
with the givenUuidRepresentation
applied to the givenCodecRegistry
- Since:
- 4.5
-
fromCodecs
Creates aCodecRegistry
from the provided list ofCodec
instances.This registry can then be used alongside other registries. Typically used when adding extra codecs to existing codecs with the
fromRegistries(CodecRegistry...)
)} helper.- Parameters:
codecs
- theCodec
to create a registry for- Returns:
- a
CodecRegistry
for the given list ofCodec
instances.
-
fromCodecs
Creates aCodecRegistry
from the provided list ofCodec
instances.This registry can then be used alongside other registries. Typically used when adding extra codecs to existing codecs with the
fromRegistries(CodecRegistry...)
)} helper.- Parameters:
codecs
- theCodec
to create a registry for- Returns:
- a
CodecRegistry
for the given list ofCodec
instances.
-
fromProviders
Creates aCodecRegistry
from the provided list ofCodecProvider
instances.The created instance can handle cycles of
Codec
dependencies, i.e when the construction of aCodec
for class A requires the construction of aCodec
for class B, and vice versa.- Parameters:
providers
- the codec provider- Returns:
- a
CodecRegistry
with the ordered list ofCodecProvider
instances. The registry is also guaranteed to be an instance of {code CodecProvider}, so that when one is passed tofromRegistries(CodecRegistry...)
orfromRegistries(java.util.List)
it will be treated as aCodecProvider
and properly resolve any dependencies between registries.
-
fromProviders
Creates aCodecRegistry
from the provided list ofCodecProvider
instances.The created instance can handle cycles of
Codec
dependencies, i.e when the construction of aCodec
for class A requires the construction of aCodec
for class B, and vice versa.- Parameters:
providers
- the codec provider- Returns:
- a
CodecRegistry
with the ordered list ofCodecProvider
instances. The registry is also guaranteed to be an instance of {code CodecProvider}, so that when one is passed tofromRegistries(CodecRegistry...)
orfromRegistries(java.util.List)
it will be treated as aCodecProvider
and properly resolve any dependencies between registries.
-
fromRegistries
ACodecRegistry
that combines the givenCodecRegistry
instances into a single registry.The registries are checked in order until one returns a
Codec
for the requestedClass
.The created instance can handle cycles of
Codec
dependencies, i.e when the construction of aCodec
for class A requires the construction of aCodec
for class B, and vice versa.Any of the given registries that also implement
CodecProvider
will be treated as aCodecProvider
instead of aCodecRegistry
, which will ensure proper resolution of any dependencies between registries.- Parameters:
registries
- the preferred registry forCodec
lookups- Returns:
- a
CodecRegistry
that combines the list ofCodecRegistry
instances into a single one
-
fromRegistries
ACodecRegistry
that combines the givenCodecRegistry
instances into a single registry.The registries are checked in order until one returns a
Codec
for the requestedClass
.The created instance can handle cycles of
Codec
dependencies, i.e when the construction of aCodec
for class A requires the construction of aCodec
for class B, and vice versa.Any of the given registries that also implement
CodecProvider
will be treated as aCodecProvider
instead of aCodecRegistry
, which will ensure proper resolution of any dependencies between registries.- Parameters:
registries
- the preferred registry forCodec
lookups- Returns:
- a
CodecRegistry
that combines the list ofCodecRegistry
instances into a single one
-