public abstract class AbstractAssembleOperationHandler extends Object implements AssembleOperationHandler
This class serves as the top-level template class
and defines the key steps required by most AssembleOperationHandler:
Object processing phase:
collectToEntities(java.util.Collection<cn.crane4j.core.executor.AssembleExecution>): Expands the target objects to be operated on from the AssembleExecution
and wraps them as AbstractAssembleOperationHandler.Target objects, which will be used for subsequent processing;
introspectForEntities(java.util.Collection<cn.crane4j.core.executor.handler.AbstractAssembleOperationHandler.Target>): If the Container for the current operation is not specified,
directly use the target objects as the data source for field mapping;
Container for the current operation is specified, it enters the data source preparation phase:
getSourcesFromContainer(cn.crane4j.core.container.Container<?>, java.util.Collection<cn.crane4j.core.executor.handler.AbstractAssembleOperationHandler.Target>): Obtains the required data sources based on the objects to be processed;
getTheAssociatedSource(cn.crane4j.core.executor.handler.AbstractAssembleOperationHandler.Target, java.util.Map<java.lang.Object, java.lang.Object>): Retrieves the associated data source object
corresponding to the key value of the object to be processed from the data sources;
completeMapping(java.lang.Object, cn.crane4j.core.executor.handler.AbstractAssembleOperationHandler.Target) method is called to perform property mapping between them.
The implementation logic of this template class is based on
the encapsulation of AbstractAssembleOperationHandler.Target, which may introduce unnecessary performance overhead.
| 限定符和类型 | 类和说明 |
|---|---|
protected static class |
AbstractAssembleOperationHandler.Target
Target object to be processed.
|
| 限定符和类型 | 字段和说明 |
|---|---|
protected boolean |
ignoreNullKey
whether ignore null key.
|
| 构造器和说明 |
|---|
AbstractAssembleOperationHandler() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected abstract void |
completeMapping(Object source,
AbstractAssembleOperationHandler.Target target)
Complete attribute mapping between the target object and the data source object.
|
protected @Nullable AbstractAssembleOperationHandler.Target |
createTarget(AssembleExecution execution,
Object origin,
Object keyValue)
Create a
AbstractAssembleOperationHandler.Target instance. |
protected Map<Object,Object> |
getSourcesFromContainer(Container<?> container,
Collection<AbstractAssembleOperationHandler.Target> targets)
Obtain the corresponding data source object from the data source container based on the entity's key value.
|
protected Object |
getTheAssociatedSource(AbstractAssembleOperationHandler.Target target,
Map<Object,Object> sources)
Get the data source object associated with the target object.
|
protected void |
introspectForEntities(Collection<AbstractAssembleOperationHandler.Target> targets)
When the container is
EmptyContainer, introspect the object to be processed. |
void |
process(Container<?> container,
Collection<AssembleExecution> executions)
Perform assembly operation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdetermineKeyResolvergetNamepublic void process(Container<?> container, Collection<AssembleExecution> executions)
process 在接口中 AssembleOperationHandlercontainer - containerexecutions - operations to be performedprotected void introspectForEntities(Collection<AbstractAssembleOperationHandler.Target> targets)
EmptyContainer, introspect the object to be processed.targets - targetsprotected Map<Object,Object> getSourcesFromContainer(Container<?> container, Collection<AbstractAssembleOperationHandler.Target> targets)
container - containertargets - targetsprotected Object getTheAssociatedSource(AbstractAssembleOperationHandler.Target target, Map<Object,Object> sources)
target - targetsources - sourcesprotected abstract void completeMapping(Object source, AbstractAssembleOperationHandler.Target target)
source - sourcetarget - targetprotected @Nullable AbstractAssembleOperationHandler.Target createTarget(AssembleExecution execution, Object origin, Object keyValue)
AbstractAssembleOperationHandler.Target instance.execution - executionorigin - originkeyValue - keyValueAbstractAssembleOperationHandler.TargetCopyright © 2024. All rights reserved.