Class DelegatingByTypeSerializer

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, org.apache.kafka.common.serialization.Serializer<java.lang.Object>

    public class DelegatingByTypeSerializer
    extends java.lang.Object
    implements org.apache.kafka.common.serialization.Serializer<java.lang.Object>
    Delegates to a serializer based on type.
    Since:
    2.7.9
    • Constructor Summary

      Constructors 
      Constructor Description
      DelegatingByTypeSerializer​(java.util.Map<java.lang.Class<?>,​org.apache.kafka.common.serialization.Serializer> delegates)
      Construct an instance with the map of delegates.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void configure​(java.util.Map<java.lang.String,​?> configs, boolean isKey)  
      byte[] serialize​(java.lang.String topic, java.lang.Object data)  
      byte[] serialize​(java.lang.String topic, org.apache.kafka.common.header.Headers headers, java.lang.Object data)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.kafka.common.serialization.Serializer

        close
    • Constructor Detail

      • DelegatingByTypeSerializer

        public DelegatingByTypeSerializer​(java.util.Map<java.lang.Class<?>,​org.apache.kafka.common.serialization.Serializer> delegates)
        Construct an instance with the map of delegates.
        Parameters:
        delegates - the delegates.
    • Method Detail

      • configure

        public void configure​(java.util.Map<java.lang.String,​?> configs,
                              boolean isKey)
        Specified by:
        configure in interface org.apache.kafka.common.serialization.Serializer<java.lang.Object>
      • serialize

        public byte[] serialize​(java.lang.String topic,
                                java.lang.Object data)
        Specified by:
        serialize in interface org.apache.kafka.common.serialization.Serializer<java.lang.Object>
      • serialize

        public byte[] serialize​(java.lang.String topic,
                                org.apache.kafka.common.header.Headers headers,
                                java.lang.Object data)
        Specified by:
        serialize in interface org.apache.kafka.common.serialization.Serializer<java.lang.Object>