Package org.redisson.codec
Class DefaultReferenceCodecProvider
java.lang.Object
org.redisson.codec.DefaultReferenceCodecProvider
- All Implemented Interfaces:
ReferenceCodecProvider
- Author:
- Rui Gu (https://github.com/jackygurui)
-
Constructor Summary
-
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> cls, T codec) Register a codec by its class or super class.
-
Constructor Details
-
DefaultReferenceCodecProvider
public DefaultReferenceCodecProvider()
-
-
Method Details
-
getCodec
Description copied from interface:ReferenceCodecProvider
Get codec instance by its class.- Specified by:
getCodec
in interfaceReferenceCodecProvider
- Type Parameters:
T
- the expected codec type.- Parameters:
codecClass
- the codec class used to lookup the codec.- Returns:
- the cached codec instance.
-
getCodec
Description copied from interface:ReferenceCodecProvider
Get a codec instance by a REntity annotation and the class annotated with it.- Specified by:
getCodec
in interfaceReferenceCodecProvider
- 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
public <T extends Codec,K extends RObject> T getCodec(RObjectField anno, Class<?> cls, Class<K> rObjectClass, String fieldName, Config config) Description copied from interface:ReferenceCodecProvider
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.- Specified by:
getCodec
in interfaceReferenceCodecProvider
- 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
Description copied from interface:ReferenceCodecProvider
Register a codec by its class or super class.- Specified by:
registerCodec
in interfaceReferenceCodecProvider
- Type Parameters:
T
- the codec type to register.- Parameters:
cls
- the codec Class to register it can be a super class of the instance.codec
- the codec instance.
-