Interface Serializer<T>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void close()
      Close this serializer.
      default void configure​(java.util.Map<java.lang.String,​?> configs, boolean isKey)
      Configure this class.
      default byte[] serialize​(java.lang.String topic, Headers headers, T data)
      Convert data into a byte array.
      byte[] serialize​(java.lang.String topic, T data)
      Convert data into a byte array.
    • Method Detail

      • configure

        default void configure​(java.util.Map<java.lang.String,​?> configs,
                               boolean isKey)
        Configure this class.
        Parameters:
        configs - configs in key/value pairs
        isKey - whether is for key or value
      • serialize

        byte[] serialize​(java.lang.String topic,
                         T data)
        Convert data into a byte array.
        Parameters:
        topic - topic associated with data
        data - typed data
        Returns:
        serialized bytes
      • serialize

        default byte[] serialize​(java.lang.String topic,
                                 Headers headers,
                                 T data)
        Convert data into a byte array.
        Parameters:
        topic - topic associated with data
        headers - headers associated with the record
        data - typed data
        Returns:
        serialized bytes
      • close

        default void close()
        Close this serializer.

        This method must be idempotent as it may be called multiple times.

        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable