S - the generic typeT - the generic typeG - the generic typepublic abstract class AbstractConvertor<S,T,G extends cn.featherfly.common.lang.reflect.Type<S>> extends java.lang.Object implements Convertor<S,T>
| 限定符和类型 | 字段和说明 |
|---|---|
protected org.slf4j.Logger |
logger
日志.
|
| 构造器和说明 |
|---|
AbstractConvertor()
Instantiates a new abstract convertor.
|
AbstractConvertor(java.lang.Class<S> sourceType,
java.lang.Class<T> targetType,
TypePolicys policy)
Instantiates a new abstract convertor.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected abstract T |
doSourceToTarget(S source,
G genericType)
源转目标
.
|
protected abstract S |
doTargetToSource(T target,
G genericType)
目标转源
.
|
TypePolicys |
getPolicy()
返回policy.
|
java.lang.Class<S> |
getSourceType()
返回sourceType.
|
java.lang.Class<T> |
getTargetType()
返回targetType.
|
void |
setPolicy(TypePolicys policy)
设置policy.
|
void |
setSourceType(java.lang.Class<S> sourceType)
设置sourceType.
|
void |
setTargetType(java.lang.Class<T> targetType)
设置targetType.
|
<GT extends cn.featherfly.common.lang.reflect.Type<S>> |
sourceToTarget(S value,
GT genericType)
转换源对象到目标类型对象
|
protected abstract boolean |
supportFor(cn.featherfly.common.lang.reflect.Type<S> generecType)
是否提供对传入类型的支持
.
|
<GT extends cn.featherfly.common.lang.reflect.Type<S>> |
targetToSource(T value,
GT genericType)
转换目标对象到源类型对象
|
public AbstractConvertor()
public AbstractConvertor(java.lang.Class<S> sourceType, java.lang.Class<T> targetType, TypePolicys policy)
sourceType - the source typetargetType - the target typepolicy - the policyprotected abstract boolean supportFor(cn.featherfly.common.lang.reflect.Type<S> generecType)
是否提供对传入类型的支持
.generecType - generecTypeprotected abstract T doSourceToTarget(S source, G genericType)
源转目标
.source - 源对象genericType - 指定对象的上下文属性protected abstract S doTargetToSource(T target, G genericType)
目标转源
.target - 目标对象genericType - 指定对象的上下文属性public <GT extends cn.featherfly.common.lang.reflect.Type<S>> T sourceToTarget(S value, GT genericType)
转换源对象到目标类型对象
sourceToTarget 在接口中 Convertor<S,T>GT - Type子类泛型value - 需要转换的对象genericType - 需要转换的对象的上下文属性public <GT extends cn.featherfly.common.lang.reflect.Type<S>> S targetToSource(T value, GT genericType)
转换目标对象到源类型对象
targetToSource 在接口中 Convertor<S,T>GT - Type子类泛型value - 需要转换的对象genericType - 指定对象的上下文属性public java.lang.Class<S> getSourceType()
getSourceType 在接口中 Convertor<S,T>public void setSourceType(java.lang.Class<S> sourceType)
sourceType - sourceTypepublic java.lang.Class<T> getTargetType()
getTargetType 在接口中 Convertor<S,T>public void setTargetType(java.lang.Class<T> targetType)
targetType - targetTypepublic TypePolicys getPolicy()
public void setPolicy(TypePolicys policy)
policy - policy