public interface BeanOperations
用于描述如何对一个JavaBean进行操作的配置对象。
通常情况下,它由解析器从类或方法上中解析得到,
并在执行器中使用,以指示执行器如何根据配置对输入对象进行操作。
通过getAssembleOperations()或getDisassembleOperations()获取到的操作配置一般是有序的,
且顺序遵循Sorted.getSort()的定义。但实际执行顺序需要由执行器来保证,
因此不同的执行器可能会导致不同的执行顺序。
由于配置可能是嵌套的,比如在一个对象中需要对一个某个属性进行拆解,而这个属性又对应另一个类型的对象,
因此在获取到的对象操作配置实例时,可能仍然处于递归解析中。
总而言之,在使用前,我们需要通过isActive()方法确保当前的配置对象已经彻底出于可用状态。
The configuration for a JavaBean operation.
Typically, it is parsed from a class by the BeanOperationParser,
and used in the BeanOperationExecutor to indicate
how the executor should operate on the input object based on the configuration.
The obtained operation configuration through getAssembleOperations() or getDisassembleOperations()
is generally in order, and the order follows the definition of Sorted.getSort().
However, the actual execution order needs to be ensured by the BeanOperationExecutor,
hence different executors may lead to different execution orders.
Since the configuration may be nested,
such as when an attribute type that needs to be disassembled in an object is another object,
the object operation configuration instance may still be in recursive resolution when obtained.
Therefore, it is essential to ensure that
the configuration object has completed resolution through isActive() before use.
AssembleOperation,
DisassembleOperation,
BeanOperationExecutor,
BeanOperationParser| 限定符和类型 | 接口和说明 |
|---|---|
static class |
BeanOperations.EmptyBeanOperations
Empty bean operations.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addAssembleOperations(AssembleOperation operation)
Add assembly operation.
|
void |
addDisassembleOperations(DisassembleOperation operation)
Add disassembly operation.
|
static BeanOperations |
empty()
Get an empty bean operations.
|
Collection<AssembleOperation> |
getAssembleOperations()
Get assembly operations.
|
Collection<DisassembleOperation> |
getDisassembleOperations()
Get disassembly operations.
|
AnnotatedElement |
getSource()
Get the source object corresponding to the current operation.
|
boolean |
isActive()
Whether the current operation configuration is active.
|
default boolean |
isEmpty()
Whether the current operation is empty.
|
void |
setActive(boolean active)
Set the current operation configuration active state.
|
static BeanOperations empty()
AnnotatedElement getSource()
Collection<AssembleOperation> getAssembleOperations()
void addAssembleOperations(AssembleOperation operation)
operation - operationCollection<DisassembleOperation> getDisassembleOperations()
void addDisassembleOperations(DisassembleOperation operation)
operation - operationboolean isActive()
void setActive(boolean active)
active - active statedefault boolean isEmpty()
Copyright © 2024. All rights reserved.