Package com.fauna.codec
Class DefaultCodecProvider
- java.lang.Object
-
- com.fauna.codec.DefaultCodecProvider
-
- All Implemented Interfaces:
CodecProvider
public final class DefaultCodecProvider extends java.lang.Object implements CodecProvider
Provides codecs for serialization and deserialization of various data types in Fauna.This provider supports codecs for primitive types, collections, optional values, documents, enums, and more.
-
-
Field Summary
Fields Modifier and Type Field Description static CodecProviderSINGLETONSingleton instance of theDefaultCodecProviderfor global access.
-
Constructor Summary
Constructors Constructor Description DefaultCodecProvider(CodecRegistry registry)Initializes a new instance ofDefaultCodecProviderwith a specified registry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Codec<T>get(java.lang.Class<T> clazz)Retrieves the codec for the specified class type.<T> Codec<T>get(java.lang.Class<T> clazz, java.lang.reflect.Type[] typeArgs)Retrieves the codec for the specified class type and type arguments.
-
-
-
Field Detail
-
SINGLETON
public static final CodecProvider SINGLETON
Singleton instance of theDefaultCodecProviderfor global access.
-
-
Constructor Detail
-
DefaultCodecProvider
public DefaultCodecProvider(CodecRegistry registry)
Initializes a new instance ofDefaultCodecProviderwith a specified registry.- Parameters:
registry- The codec registry to store generated codecs.
-
-
Method Detail
-
get
public <T> Codec<T> get(java.lang.Class<T> clazz)
Retrieves the codec for the specified class type.- Specified by:
getin interfaceCodecProvider- Type Parameters:
T- The data type to be encoded or decoded.- Parameters:
clazz- The class for which a codec is requested.- Returns:
- The
Codecassociated with the class.
-
get
public <T> Codec<T> get(java.lang.Class<T> clazz, java.lang.reflect.Type[] typeArgs)
Retrieves the codec for the specified class type and type arguments.- Specified by:
getin interfaceCodecProvider- Type Parameters:
T- The data type to be encoded or decoded.- Parameters:
clazz- The class for which a codec is requested.typeArgs- The type arguments for generic classes.- Returns:
- The
Codecassociated with the class and type arguments.
-
-