Class KeyedSerializationSchemaWrapper<T>
- java.lang.Object
-
- org.apache.flink.streaming.connectors.kafka.internals.KeyedSerializationSchemaWrapper<T>
-
- Type Parameters:
T- The type to serialize
- All Implemented Interfaces:
Serializable,KeyedSerializationSchema<T>
@Internal public class KeyedSerializationSchemaWrapper<T> extends Object implements KeyedSerializationSchema<T>
A simple wrapper for using the SerializationSchema with the KeyedSerializationSchema interface.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description KeyedSerializationSchemaWrapper(org.apache.flink.api.common.serialization.SerializationSchema<T> serializationSchema)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.flink.api.common.serialization.SerializationSchema<T>getSerializationSchema()StringgetTargetTopic(T element)Optional method to determine the target topic for the element.byte[]serializeKey(T element)Serializes the key of the incoming element to a byte array This method might return null if no key is available.byte[]serializeValue(T element)Serializes the value of the incoming element to a byte array.
-
-
-
Constructor Detail
-
KeyedSerializationSchemaWrapper
public KeyedSerializationSchemaWrapper(org.apache.flink.api.common.serialization.SerializationSchema<T> serializationSchema)
-
-
Method Detail
-
getSerializationSchema
public org.apache.flink.api.common.serialization.SerializationSchema<T> getSerializationSchema()
-
serializeKey
public byte[] serializeKey(T element)
Description copied from interface:KeyedSerializationSchemaSerializes the key of the incoming element to a byte array This method might return null if no key is available.- Specified by:
serializeKeyin interfaceKeyedSerializationSchema<T>- Parameters:
element- The incoming element to be serialized- Returns:
- the key of the element as a byte array
-
serializeValue
public byte[] serializeValue(T element)
Description copied from interface:KeyedSerializationSchemaSerializes the value of the incoming element to a byte array.- Specified by:
serializeValuein interfaceKeyedSerializationSchema<T>- Parameters:
element- The incoming element to be serialized- Returns:
- the value of the element as a byte array
-
getTargetTopic
public String getTargetTopic(T element)
Description copied from interface:KeyedSerializationSchemaOptional method to determine the target topic for the element.- Specified by:
getTargetTopicin interfaceKeyedSerializationSchema<T>- Parameters:
element- Incoming element to determine the target topic from- Returns:
- null or the target topic
-
-