Interface Serializer<T>
- 
- Type Parameters:
 T- Type to be serialized from.
- All Superinterfaces:
 java.lang.AutoCloseable,java.io.Closeable
- All Known Subinterfaces:
 ExtendedSerializer<T>
- All Known Implementing Classes:
 ByteArraySerializer,ByteBufferSerializer,BytesSerializer,DoubleSerializer,ExtendedSerializer.Wrapper,FloatSerializer,IntegerSerializer,LongSerializer,ShortSerializer,StringSerializer,UUIDSerializer,VoidSerializer
public interface Serializer<T> extends java.io.CloseableAn interface for converting objects to bytes. A class that implements this interface is expected to have a constructor with no parameter.Implement
ClusterResourceListenerto receive cluster metadata once it's available. Please see the class documentation for ClusterResourceListener for more information. 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidclose()Close this serializer.default voidconfigure(java.util.Map<java.lang.String,?> configs, boolean isKey)Configure this class.default byte[]serialize(java.lang.String topic, Headers headers, T data)Convertdatainto a byte array.byte[]serialize(java.lang.String topic, T data)Convertdatainto 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 pairsisKey- whether is for key or value
 
- 
serialize
byte[] serialize(java.lang.String topic, T data)Convertdatainto a byte array.- Parameters:
 topic- topic associated with datadata- typed data- Returns:
 - serialized bytes
 
 
- 
serialize
default byte[] serialize(java.lang.String topic, Headers headers, T data)Convertdatainto a byte array.- Parameters:
 topic- topic associated with dataheaders- headers associated with the recorddata- 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:
 closein interfacejava.lang.AutoCloseable- Specified by:
 closein interfacejava.io.Closeable
 
 - 
 
 -