Class DefaultCodecRegistry

  • All Implemented Interfaces:
    CodecRegistry

    public final class DefaultCodecRegistry
    extends java.lang.Object
    implements CodecRegistry
    The default codec registry for Fauna serialization and deserialization.

    This registry provides pre-defined codecs for common data types, enabling serialization to and deserialization from FQL.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static CodecRegistry SINGLETON
      Singleton instance of the DefaultCodecRegistry for global access.
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultCodecRegistry()
      Initializes a new instance of DefaultCodecRegistry with predefined codecs for commonly used data types.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(CodecRegistryKey key)
      Checks if the registry contains a codec for the specified key.
      <T> Codec<T> get​(CodecRegistryKey key)
      Retrieves the codec associated with the specified key, if it exists.
      <T> void put​(CodecRegistryKey key, Codec<T> codec)
      Registers a new codec for the specified key in the registry.
      • Methods inherited from class java.lang.Object

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

      • SINGLETON

        public static final CodecRegistry SINGLETON
        Singleton instance of the DefaultCodecRegistry for global access.
    • Constructor Detail

      • DefaultCodecRegistry

        public DefaultCodecRegistry()
        Initializes a new instance of DefaultCodecRegistry with predefined codecs for commonly used data types.
    • Method Detail

      • get

        public <T> Codec<T> get​(CodecRegistryKey key)
        Retrieves the codec associated with the specified key, if it exists.
        Specified by:
        get in interface CodecRegistry
        Type Parameters:
        T - The data type to be encoded or decoded.
        Parameters:
        key - The CodecRegistryKey representing the data type.
        Returns:
        The Codec associated with the key, or null if not found.
      • put

        public <T> void put​(CodecRegistryKey key,
                            Codec<T> codec)
        Registers a new codec for the specified key in the registry.
        Specified by:
        put in interface CodecRegistry
        Type Parameters:
        T - The data type to be encoded or decoded.
        Parameters:
        key - The CodecRegistryKey representing the data type.
        codec - The Codec to associate with the key.
      • contains

        public boolean contains​(CodecRegistryKey key)
        Checks if the registry contains a codec for the specified key.
        Specified by:
        contains in interface CodecRegistry
        Parameters:
        key - The CodecRegistryKey representing the data type.
        Returns:
        true if a codec for the key is registered; otherwise, false.