Class 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 CodecProvider SINGLETON
      Singleton instance of the DefaultCodecProvider for global access.
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultCodecProvider​(CodecRegistry registry)
      Initializes a new instance of DefaultCodecProvider with 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SINGLETON

        public static final CodecProvider SINGLETON
        Singleton instance of the DefaultCodecProvider for global access.
    • Constructor Detail

      • DefaultCodecProvider

        public DefaultCodecProvider​(CodecRegistry registry)
        Initializes a new instance of DefaultCodecProvider with 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:
        get in interface CodecProvider
        Type Parameters:
        T - The data type to be encoded or decoded.
        Parameters:
        clazz - The class for which a codec is requested.
        Returns:
        The Codec associated 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:
        get in interface CodecProvider
        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 Codec associated with the class and type arguments.