public class RootCodecRegistry extends Object implements CodecRegistry
Constructor and Description |
---|
RootCodecRegistry(List<? extends CodecProvider> codecProviders)
Construct a new
CodecRegistry from the given list if CodecProvider instances. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
<T> Codec<T> |
get(Class<T> clazz)
Gets a
Codec for the given Class. |
int |
hashCode() |
<T> RootCodecRegistry |
withCodec(Codec<T> codec)
Creates a new registry which is identical to this with the addition of the given codec.
|
public RootCodecRegistry(List<? extends CodecProvider> codecProviders)
CodecRegistry
from the given list if CodecProvider
instances. The registry will use the codec
providers to find Codec instances, consulting each provider in order, and return the first Codec found. Therefore,
care should be taken to order the codec providers to achieve the desired behavior.codecProviders
- the list of codec providerspublic <T> RootCodecRegistry withCodec(Codec<T> codec)
T
- the class type of the codeccodec
- the codecpublic <T> Codec<T> get(Class<T> clazz)
Codec
for the given Class.get
in interface CodecRegistry
T
- the class typeclazz
- the classCodecConfigurationException
- if the registry does not contain a codec for the given class.