Interface Serializer<T>
- Type Parameters:
T- Type to be serialized from.
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
BooleanSerializer,ByteArraySerializer,ByteBufferSerializer,BytesSerializer,DoubleSerializer,FloatSerializer,IntegerSerializer,ListSerializer,LongSerializer,ShortSerializer,StringSerializer,UUIDSerializer,VoidSerializer
An interface for converting objects to bytes. A class that implements this interface is expected to have a constructor with no parameter.
Implement ClusterResourceListener to receive cluster metadata once it's available. Please see the class documentation for ClusterResourceListener for more information.
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Close this serializer.default voidConfigure this class.default byte[]Convertdatainto a byte array.byte[]Convertdatainto a byte array.
Method Details
configure
Configure this class.- Parameters:
configs- configs in key/value pairsisKey- whether is for key or value
serialize
Convertdatainto a byte array.- Parameters:
topic- topic associated with datadata- typed data- Returns:
- serialized bytes
serialize
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 interfaceAutoCloseable- Specified by:
closein interfaceCloseable