Class MapCodec<V,​L extends java.util.Map<java.lang.String,​V>>

  • Type Parameters:
    V - The type of the values in the map.
    L - The type of the map.
    All Implemented Interfaces:
    Codec<L>

    public final class MapCodec<V,​L extends java.util.Map<java.lang.String,​V>>
    extends BaseCodec<L>
    A codec for encoding and decoding Map values in Fauna's tagged data format.

    This class handles encoding and decoding of maps, where the keys are strings and the values are of a generic type V.

    • Constructor Detail

      • MapCodec

        public MapCodec​(Codec<V> valueCodec)
        Constructs a MapCodec with the specified Codec.
        Parameters:
        valueCodec - The codec to use for the value.
    • Method Detail

      • decode

        public L decode​(UTF8FaunaParser parser)
                 throws CodecException
        Description copied from interface: Codec
        Decodes an object from the provided UTF8FaunaParser.
        Parameters:
        parser - The parser to use for reading and decoding the data.
        Returns:
        The decoded object of type T.
        Throws:
        CodecException - If an error occurs during decoding.
      • encode

        public void encode​(UTF8FaunaGenerator gen,
                           L obj)
                    throws CodecException
        Description copied from interface: Codec
        Encodes the specified object using the provided UTF8FaunaGenerator.
        Parameters:
        gen - The generator to use for writing and encoding the data.
        obj - The object of type T to encode.
        Throws:
        CodecException - If an error occurs during encoding.
      • getCodecClass

        public java.lang.Class<?> getCodecClass()
        Description copied from interface: Codec
        Gets the class associated with this codec.
        Returns:
        The Class type that this codec handles.
      • getSupportedTypes

        public FaunaType[] getSupportedTypes()
        Description copied from interface: Codec
        Gets the set of supported Fauna data types for this codec.
        Returns:
        An array of FaunaType values representing the supported types.