public class AbstractOrderlyHandlerChain extends Object implements OperateHandlerChain
OperateHandlerChain.handlers()与OperateHandlerChain.interceptors()皆按Orderly.comparator()排序的处理器链,提供一些方法的基本实现| 限定符和类型 | 字段和说明 |
|---|---|
protected List<OperateHandler> |
handlers |
protected List<SourceOperateInterceptor> |
interceptors |
| 构造器和说明 |
|---|
AbstractOrderlyHandlerChain() |
| 限定符和类型 | 方法和说明 |
|---|---|
OperateHandlerChain |
addHandler(OperateHandler handler)
添加处理器节点
|
OperateHandlerChain |
addInterceptor(SourceOperateInterceptor interceptor)
注册操作拦截器
|
Object |
readFromSource(Object source,
PropertyMapping property,
Operation operation)
将数据源对象使用操作拦截器处理后,再使用处理器链中第一个支持处理该拦截诡异的数据源对象的操作处理器,从中获取所需数据源
|
boolean |
sourceCanRead(Object source,
PropertyMapping property,
Operation operation)
处理器链中是否存在可以从数据源中读取数据的节点
|
boolean |
targetCanWrite(Object sourceData,
Object target,
PropertyMapping property,
AssembleOperation operation)
处理器链中是否存在可以将数据源数据写入待处理对象的节点
|
Object |
tryReadFromSource(Object source,
PropertyMapping property,
Operation operation)
若
sourceCanRead(Object, PropertyMapping, Operation)方法返回ture,
则返回readFromSource(Object, PropertyMapping, Operation)的返回值,否则直接返回null |
void |
tryWriteToTarget(Object sourceData,
Object target,
PropertyMapping property,
AssembleOperation operation)
|
void |
writeToTarget(Object sourceData,
Object target,
PropertyMapping property,
AssembleOperation operation)
将数据源数据使用操作拦截器处理后,再使用处理器链中第一个支持处理该待处理对象的操作处理器,将拦截后的数据源数据写入待处理对象
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlers, interceptorscomparator, compareTo, getActualOrder, getOrderprotected final List<OperateHandler> handlers
protected final List<SourceOperateInterceptor> interceptors
public OperateHandlerChain addInterceptor(SourceOperateInterceptor interceptor)
OperateHandlerChainaddInterceptor 在接口中 OperateHandlerChaininterceptor - 拦截器public OperateHandlerChain addHandler(OperateHandler handler)
OperateHandlerChainaddHandler 在接口中 OperateHandlerChainhandler - 处理器节点public boolean sourceCanRead(Object source, PropertyMapping property, Operation operation)
sourceCanRead 在接口中 OperateHandlersource - 数据源property - 待处理字段operation - 字段配置public Object readFromSource(Object source, PropertyMapping property, Operation operation)
readFromSource 在接口中 OperateHandlersource - 数据源property - 待处理字段operation - 字段配置public Object tryReadFromSource(Object source, PropertyMapping property, Operation operation)
sourceCanRead(Object, PropertyMapping, Operation)方法返回ture,
则返回readFromSource(Object, PropertyMapping, Operation)的返回值,否则直接返回nulltryReadFromSource 在接口中 OperateHandlerChainsource - 数据源property - 待处理字段operation - 字段配置public boolean targetCanWrite(Object sourceData, Object target, PropertyMapping property, AssembleOperation operation)
targetCanWrite 在接口中 OperateHandlersourceData - 从数据源获取的数据target - 待处理对象property - 待处理字段operation - 字段配置public void writeToTarget(Object sourceData, Object target, PropertyMapping property, AssembleOperation operation)
writeToTarget 在接口中 OperateHandlersourceData - 从数据源获取的数据target - 待处理对象property - 待处理字段operation - 字段配置public void tryWriteToTarget(Object sourceData, Object target, PropertyMapping property, AssembleOperation operation)
targetCanWrite(Object, Object, PropertyMapping, AssembleOperation)返回ture,
则调用writeToTarget(Object, Object, PropertyMapping, AssembleOperation)tryWriteToTarget 在接口中 OperateHandlerChainsourceData - 从数据源获取的数据target - 待处理对象property - 待处理字段operation - 字段配置Copyright © 2022. All rights reserved.