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