public class DefaultReferenceCodecProvider extends Object implements ReferenceCodecProvider
Modifier and Type | Field and Description |
---|---|
ConcurrentMap<Class<? extends Codec>,Codec> |
codecCache |
Constructor and Description |
---|
DefaultReferenceCodecProvider() |
Modifier and Type | Method and Description |
---|---|
<T extends Codec> |
getCodec(Class<T> codecClass)
Get codec instance by its class.
|
<T extends Codec> |
getCodec(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> |
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.
|
<T extends Codec> |
registerCodec(Class<T> cls,
T codec)
Register a codec by its class or super class.
|
public final transient ConcurrentMap<Class<? extends Codec>,Codec> codecCache
public <T extends Codec> T getCodec(Class<T> codecClass)
ReferenceCodecProvider
getCodec
in interface ReferenceCodecProvider
T
- the expected codec type.codecClass
- the codec class used to lookup the codec.public <T extends Codec> T getCodec(REntity anno, Class<?> cls, Config config)
ReferenceCodecProvider
getCodec
in interface ReferenceCodecProvider
T
- the expected codec type.anno
- REntity annotation used on the class.cls
- The class that has the REntity annotation.config
- Redisson config objectpublic <T extends Codec,K extends RObject> T getCodec(RObjectField anno, Class<?> cls, Class<K> rObjectClass, String fieldName, Config config)
ReferenceCodecProvider
getCodec
in interface ReferenceCodecProvider
T
- the expected codec type.K
- the type of the RObject.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 objectpublic <T extends Codec> void registerCodec(Class<T> cls, T codec)
ReferenceCodecProvider
registerCodec
in interface ReferenceCodecProvider
T
- the codec type to register.cls
- the codec Class to register it can be a super class of
the instance.codec
- the codec instance.Copyright © 2014–2018 The Redisson Project. All rights reserved.