Interface Codec
- All Known Implementing Classes:
Codecs.ByteArrayCodec,Codecs.DoubleCodec,Codecs.IntegerCodec,Codecs.JsonCodec,Codecs.StringCodec
public interface Codec
Redis codec interface.
The Redis data source uses this interface to serialize and deserialize data to and from Redis. A set of default codecs are provided for Strings, Integers, Doubles and Byte arrays. For custom types, either there is a specific implementation of this interface exposed as CDI (Application Scoped) bean, or JSON is used.
-
Method Summary
-
Method Details
-
canHandle
Checks if the current codec can handle the serialization and deserialization of object from the given type.- Parameters:
clazz- the type, cannot benull- Returns:
trueif the codec can handle the type,falseotherwise
-
encode
Encodes the given object. The type of the given object matches the type used to call thecanHandle(Type)method.- Parameters:
item- the item- Returns:
- the encoded content
-
decode
Decodes the given bytes to an object. The codec must return an instance of the type used to call thecanHandle(Type)method.- Parameters:
item- the bytes- Returns:
- the object
-