Package org.redisson.codec
Interface ReferenceCodecProvider
- All Known Implementing Classes:
DefaultReferenceCodecProvider
public interface ReferenceCodecProvider
- Author:
- Rui Gu (https://github.com/jackygurui)
-
Method Summary
Modifier and TypeMethodDescription<T extends Codec>
TGet codec instance by its class.<T extends Codec>
TGet a codec instance by a REntity annotation and the class annotated with it.Get a codec instance by a RObjectField annotation and the class annotated with REntity, the implementation class of RObject the field is going to be transformed into and the name of the field with this RObjectField annotation.<T extends Codec>
voidregisterCodec
(Class<T> codecClass, T codec) Register a codec by its class or super class.
-
Method Details
-
getCodec
Get codec instance by its class.- Type Parameters:
T
- the expected codec type.- Parameters:
codecClass
- the codec class used to lookup the codec.- Returns:
- the cached codec instance.
-
getCodec
Get a codec instance by a REntity annotation and the class annotated with it.- Type Parameters:
T
- the expected codec type.- Parameters:
anno
- REntity annotation used on the class.cls
- The class that has the REntity annotation.config
- Redisson config object- Returns:
- the cached codec instance.
-
getCodec
<T extends Codec,K extends RObject> T getCodec(RObjectField anno, Class<?> cls, Class<K> rObjectClass, String fieldName, Config config) Get a codec instance by a RObjectField annotation and the class annotated with REntity, the implementation class of RObject the field is going to be transformed into and the name of the field with this RObjectField annotation.- Type Parameters:
T
- the expected codec type.K
- the type of the RObject.- Parameters:
anno
- RObjectField annotation used on the field.cls
- The class that has the REntity annotation.rObjectClass
- the implementation class of RObject the field is going to be transformed into.fieldName
- the name of the field with this RObjectField annotation.config
- Redisson config object- Returns:
- the cached codec instance.
-
registerCodec
Register a codec by its class or super class.- Type Parameters:
T
- the codec type to register.- Parameters:
codecClass
- the codec Class to register it can be a super class of the instance.codec
- the codec instance.
-