Class KafkaEnDec

java.lang.Object
io.aiven.kafka.connect.amqp.common.data.EncoderDecoder
io.aiven.kafka.connect.amqp.common.data.KafkaEnDec

public final class KafkaEnDec extends EncoderDecoder
Performs Kafka conversions.

This converter will handle;

  • null values into an optional byte schema with a null value. This only occurs if the includeNull flag is set in the constructor.
  • Any value that has an inferred schema form Values.inferSchema(Object)
  • BigInteger into a string value. The schema name for the encoded value is "BigInteger"
  • BigDecimal into a string value. The schema name for the encoded value is "BigDecimal"
  • Constructor Details

    • KafkaEnDec

      public KafkaEnDec()
      Constructs an encoder that does convert null values.
  • Method Details

    • encode

      public Optional<org.apache.kafka.connect.data.SchemaAndValue> encode(Object value)
      Description copied from class: EncoderDecoder
      Encodes the value as a SchemaAndValue. If this converter can not perform the encoding it returns an empty Optional.
      Specified by:
      encode in class EncoderDecoder
      Parameters:
      value - the value to convert.
      Returns:
      the Optional SchemaAndValue or an empty Optional.
    • decode

      public Optional<Object> decode(org.apache.kafka.connect.data.SchemaAndValue schemaAndValue)
      Description copied from class: EncoderDecoder
      Decodes a SchemaAndValue into an object. If this converter can not perform the decoding it returns an empty Optional.
      Specified by:
      decode in class EncoderDecoder
      Parameters:
      schemaAndValue - the schema and value to decode.
      Returns:
      the Optional Object or an empty Optional if not decoded.