@Target(value={METHOD,PARAMETER,ANNOTATION_TYPE,TYPE}) @Retention(value=RUNTIME) @Documented public @interface AutoOperate
Mark a AnnotatedElement to indicate that
after a specific step, the instance corresponding to the element
will automatically complete the filling operation.
For example, mark it on a method to indicate that its return value needs to be automatic filling after a method call, or mark it on a class to indicate that automatic filling is required during its serialization.
ArgAutoOperate,
cn.crane4j.core.support.auto.AutoOperateAnnotatedElement,
cn.crane4j.core.support.auto.AutoOperateAnnotatedElementResolver| 限定符和类型 | 可选元素和说明 |
|---|---|
String |
condition
The expression of apply condition.
|
String[] |
excludes
The group of operations not to be performed.
|
String |
executor
The name of the executor to be used.
|
Class<?> |
executorType
The type of the executor to be used.
|
String[] |
includes
The group of operations to be performed.
|
String |
on
When the return value is a wrapper class,
we can specify to obtain the dataset to be processed
from the specific field of the wrapper class, and then process it。
|
String |
parser
The name of the operation parser to be used.
|
Class<?> |
parserType
The type of the operation parser to be used.
|
boolean |
resolveOperationsFromCurrentElement
Whether to resolve the operations from the current element
when annotated on method.
|
Class<?> |
type
The object type to be processed in the return value of the method.
|
String |
value
When used in
ArgAutoOperate, it is used to bind the corresponding parameter name. |
public abstract String value
ArgAutoOperate, it is used to bind the corresponding parameter name.public abstract Class<?> type
The object type to be processed in the return value of the method.
It will be parsed by the parser specified in parser() when it is first executed,
and then the operation configuration will be obtained.
If the object is generic or cannot be confirmed, the default value is Object,
and the type will be automatically inferred.
cn.crane4j.core.support.TypeResolverpublic abstract boolean resolveOperationsFromCurrentElement
Whether to resolve the operations from the current element
when annotated on method.
When this option is true, type() will be ignored.
public abstract String on
When the return value is a wrapper class,
we can specify to obtain the dataset to be processed
from the specific field of the wrapper class, and then process it。
This configuration is generally used to process the method
of returning the general response body in the Controller。
For example:
// general response public static class Result{ private Integer code; private T data; // objects to be processed } // process general response
public abstract String executor
cn.crane4j.core.executor.BeanOperationExecutorpublic abstract Class<?> executorType
cn.crane4j.core.executor.BeanOperationExecutorpublic abstract String parser
cn.crane4j.core.parser.BeanOperationParserpublic abstract Class<?> parserType
cn.crane4j.core.parser.BeanOperationParserpublic abstract String[] includes
public abstract String[] excludes
The group of operations not to be performed.
The priority of this configuration is higher than includes()
public abstract String condition
The expression of apply condition.
The operation will only be performed when the expression result is true or "true" string。
The following variables can be used by default in the expression:
@beanName:beans in spring context;#parameterName: arguments of method;#result: return value of method;Copyright © 2024. All rights reserved.