Class DelegatingDeserializer

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

    public class DelegatingDeserializer
    extends java.lang.Object
    implements org.apache.kafka.common.serialization.Deserializer<java.lang.Object>
    A Deserializer that delegates to other deserializers based on a serialization selector header. It is not necessary to configure standard deserializers supported by Serdes.
    Since:
    2.3
    Author:
    Gary Russell
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addDelegate​(java.lang.String selector, org.apache.kafka.common.serialization.Deserializer<?> deserializer)  
      void close()  
      void configure​(java.util.Map<java.lang.String,​?> configs, boolean isKey)  
      protected static java.util.Map<java.lang.String,​org.apache.kafka.common.serialization.Deserializer<?>> createDelegates​(java.lang.String mappings, java.util.Map<java.lang.String,​?> configs, boolean isKey)  
      protected static void createInstanceAndConfigure​(java.util.Map<java.lang.String,​?> configs, boolean isKey, java.util.Map<java.lang.String,​org.apache.kafka.common.serialization.Deserializer<?>> delegateMap, java.lang.String selector, java.lang.String className)  
      java.lang.Object deserialize​(java.lang.String topic, byte[] data)  
      java.lang.Object deserialize​(java.lang.String topic, org.apache.kafka.common.header.Headers headers, byte[] data)  
      protected static void instantiateAndConfigure​(java.util.Map<java.lang.String,​?> configs, boolean isKey, java.util.Map<java.lang.String,​org.apache.kafka.common.serialization.Deserializer<?>> delegateMap, java.lang.String selector, java.lang.Class<?> clazz)  
      org.apache.kafka.common.serialization.Deserializer<?> removeDelegate​(java.lang.String selector)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.Deserializer<java.lang.Object>
      • createDelegates

        protected static java.util.Map<java.lang.String,​org.apache.kafka.common.serialization.Deserializer<?>> createDelegates​(java.lang.String mappings,
                                                                                                                                     java.util.Map<java.lang.String,​?> configs,
                                                                                                                                     boolean isKey)
      • createInstanceAndConfigure

        protected static void createInstanceAndConfigure​(java.util.Map<java.lang.String,​?> configs,
                                                         boolean isKey,
                                                         java.util.Map<java.lang.String,​org.apache.kafka.common.serialization.Deserializer<?>> delegateMap,
                                                         java.lang.String selector,
                                                         java.lang.String className)
      • instantiateAndConfigure

        protected static void instantiateAndConfigure​(java.util.Map<java.lang.String,​?> configs,
                                                      boolean isKey,
                                                      java.util.Map<java.lang.String,​org.apache.kafka.common.serialization.Deserializer<?>> delegateMap,
                                                      java.lang.String selector,
                                                      java.lang.Class<?> clazz)
      • addDelegate

        public void addDelegate​(java.lang.String selector,
                                org.apache.kafka.common.serialization.Deserializer<?> deserializer)
      • removeDelegate

        @Nullable
        public org.apache.kafka.common.serialization.Deserializer<?> removeDelegate​(java.lang.String selector)
      • deserialize

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

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

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface org.apache.kafka.common.serialization.Deserializer<java.lang.Object>