Class ExtendedSerializer.Wrapper<T>
- java.lang.Object
-
- org.apache.kafka.common.serialization.ExtendedSerializer.Wrapper<T>
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ExtendedSerializer<T>
,Serializer<T>
- Enclosing interface:
- ExtendedSerializer<T>
public static class ExtendedSerializer.Wrapper<T> extends Object implements ExtendedSerializer<T>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.kafka.common.serialization.ExtendedSerializer
ExtendedSerializer.Wrapper<T>
-
-
Constructor Summary
Constructors Constructor Description Wrapper(Serializer<T> serializer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close this serializer.void
configure(Map<String,?> configs, boolean isKey)
Configure this class.static <T> ExtendedSerializer<T>
ensureExtended(Serializer<T> serializer)
byte[]
serialize(String topic, Headers headers, T data)
Convertdata
into a byte array.byte[]
serialize(String topic, T data)
Convertdata
into a byte array.
-
-
-
Constructor Detail
-
Wrapper
public Wrapper(Serializer<T> serializer)
-
-
Method Detail
-
serialize
public byte[] serialize(String topic, Headers headers, T data)
Description copied from interface:ExtendedSerializer
Convertdata
into a byte array.- Specified by:
serialize
in interfaceExtendedSerializer<T>
- Specified by:
serialize
in interfaceSerializer<T>
- Parameters:
topic
- topic associated with dataheaders
- headers associated with the recorddata
- typed data- Returns:
- serialized bytes
-
configure
public void configure(Map<String,?> configs, boolean isKey)
Description copied from interface:Serializer
Configure this class.- Specified by:
configure
in interfaceSerializer<T>
- Parameters:
configs
- configs in key/value pairsisKey
- whether is for key or value
-
serialize
public byte[] serialize(String topic, T data)
Description copied from interface:Serializer
Convertdata
into a byte array.- Specified by:
serialize
in interfaceSerializer<T>
- Parameters:
topic
- topic associated with datadata
- typed data- Returns:
- serialized bytes
-
close
public void close()
Description copied from interface:Serializer
Close this serializer.This method must be idempotent as it may be called multiple times.
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceSerializer<T>
-
ensureExtended
public static <T> ExtendedSerializer<T> ensureExtended(Serializer<T> serializer)
-
-