Package org.redisson.codec
Class DefaultReferenceCodecProvider
- java.lang.Object
-
- org.redisson.codec.DefaultReferenceCodecProvider
-
- All Implemented Interfaces:
ReferenceCodecProvider
public class DefaultReferenceCodecProvider extends Object implements ReferenceCodecProvider
- Author:
- Rui Gu (https://github.com/jackygurui)
-
-
Constructor Summary
Constructors Constructor Description DefaultReferenceCodecProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Codec>
TgetCodec(Class<T> codecClass)Get codec instance by its class.<T extends Codec>
TgetCodec(REntity anno, Class<?> cls, Config config)Get a codec instance by a REntity annotation and the class annotated with it.<T extends Codec,K extends RObject>
TgetCodec(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.<T extends Codec>
voidregisterCodec(Class<T> cls, T codec)Register a codec by its class or super class.
-
-
-
Method Detail
-
getCodec
public <T extends Codec> T getCodec(Class<T> codecClass)
Description copied from interface:ReferenceCodecProviderGet codec instance by its class.- Specified by:
getCodecin interfaceReferenceCodecProvider- Type Parameters:
T- the expected codec type.- Parameters:
codecClass- the codec class used to lookup the codec.- Returns:
- the cached codec instance.
-
getCodec
public <T extends Codec> T getCodec(REntity anno, Class<?> cls, Config config)
Description copied from interface:ReferenceCodecProviderGet a codec instance by a REntity annotation and the class annotated with it.- Specified by:
getCodecin 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:ReferenceCodecProviderGet 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:
getCodecin 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
public <T extends Codec> void registerCodec(Class<T> cls, T codec)
Description copied from interface:ReferenceCodecProviderRegister a codec by its class or super class.- Specified by:
registerCodecin 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.
-
-