Class CodecRegistries
- Since:
- 3.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic CodecRegistryfromCodecs(List<? extends Codec<?>> codecs) Creates aCodecRegistryfrom the provided list ofCodecinstances.static CodecRegistryfromCodecs(Codec<?>... codecs) Creates aCodecRegistryfrom the provided list ofCodecinstances.static CodecRegistryfromProviders(List<? extends CodecProvider> providers) Creates aCodecRegistryfrom the provided list ofCodecProviderinstances.static CodecRegistryfromProviders(CodecProvider... providers) Creates aCodecRegistryfrom the provided list ofCodecProviderinstances.static CodecRegistryfromRegistries(List<? extends CodecRegistry> registries) ACodecRegistrythat combines the givenCodecRegistryinstances into a single registry.static CodecRegistryfromRegistries(CodecRegistry... registries) ACodecRegistrythat combines the givenCodecRegistryinstances into a single registry.static CodecRegistrywithUuidRepresentation(CodecRegistry codecRegistry, UuidRepresentation uuidRepresentation) Apply givenUuidRepresentationto the givenCodecRegistry.
-
Method Details
-
withUuidRepresentation
public static CodecRegistry withUuidRepresentation(CodecRegistry codecRegistry, UuidRepresentation uuidRepresentation) Apply givenUuidRepresentationto the givenCodecRegistry.- Parameters:
codecRegistry- the code registryuuidRepresentation- the uuid representation- Returns:
- a
CodecRegistrywith the givenUuidRepresentationapplied to the givenCodecRegistry - Since:
- 4.5
-
fromCodecs
Creates aCodecRegistryfrom the provided list ofCodecinstances.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- theCodecto create a registry for- Returns:
- a
CodecRegistryfor the given list ofCodecinstances.
-
fromCodecs
Creates aCodecRegistryfrom the provided list ofCodecinstances.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- theCodecto create a registry for- Returns:
- a
CodecRegistryfor the given list ofCodecinstances.
-
fromProviders
Creates aCodecRegistryfrom the provided list ofCodecProviderinstances.The created instance can handle cycles of
Codecdependencies, i.e when the construction of aCodecfor class A requires the construction of aCodecfor class B, and vice versa.- Parameters:
providers- the codec provider- Returns:
- a
CodecRegistrywith the ordered list ofCodecProviderinstances. 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 aCodecProviderand properly resolve any dependencies between registries.
-
fromProviders
Creates aCodecRegistryfrom the provided list ofCodecProviderinstances.The created instance can handle cycles of
Codecdependencies, i.e when the construction of aCodecfor class A requires the construction of aCodecfor class B, and vice versa.- Parameters:
providers- the codec provider- Returns:
- a
CodecRegistrywith the ordered list ofCodecProviderinstances. 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 aCodecProviderand properly resolve any dependencies between registries.
-
fromRegistries
ACodecRegistrythat combines the givenCodecRegistryinstances into a single registry.The registries are checked in order until one returns a
Codecfor the requestedClass.The created instance can handle cycles of
Codecdependencies, i.e when the construction of aCodecfor class A requires the construction of aCodecfor class B, and vice versa.Any of the given registries that also implement
CodecProviderwill be treated as aCodecProviderinstead of aCodecRegistry, which will ensure proper resolution of any dependencies between registries.- Parameters:
registries- the preferred registry forCodeclookups- Returns:
- a
CodecRegistrythat combines the list ofCodecRegistryinstances into a single one
-
fromRegistries
ACodecRegistrythat combines the givenCodecRegistryinstances into a single registry.The registries are checked in order until one returns a
Codecfor the requestedClass.The created instance can handle cycles of
Codecdependencies, i.e when the construction of aCodecfor class A requires the construction of aCodecfor class B, and vice versa.Any of the given registries that also implement
CodecProviderwill be treated as aCodecProviderinstead of aCodecRegistry, which will ensure proper resolution of any dependencies between registries.- Parameters:
registries- the preferred registry forCodeclookups- Returns:
- a
CodecRegistrythat combines the list ofCodecRegistryinstances into a single one
-