public class MethodResultAutoOperateSupport extends Object
一个用于在方法调用后,根据AutoOperate注解的配置,对方法返回结果进行填充的辅助类。
在方法调用后,其将会把方法返回结果解析为一个需要进行填充的元素,
方法返回结果对应的AutoOperateAnnotatedElement将会被缓存,避免重复解析。
当方法被调用后,辅助类将根据配置对方法返回结果进行填充。
辅助类支持通过AutoOperate.condition()设置的条件表达式,
每次执行时都会通过MethodBasedExpressionEvaluator来进行求值,
只有当表达式返回true或者 "true" 字符串时,才会执行填充。
Support class for completing the operation for the result of method which annotated by AutoOperate.
Before the method is called, the method return type will be resolved
to AutoOperateAnnotatedElement by AutoOperateAnnotatedElement and cached.
After the method is called, the AutoOperateAnnotatedElement
will be used to complete the operation of data from the method result.
Support expression for AutoOperate.condition(), if the expression is not empty,
the expression will be evaluated by MethodBasedExpressionEvaluator,
only when the expression returns true or "true", the operation will be applied.
AutoOperateAnnotatedElementResolver| 限定符和类型 | 字段和说明 |
|---|---|
protected AnnotationFinder |
annotationFinder |
protected AutoOperateAnnotatedElementResolver |
elementResolver |
protected MethodBasedExpressionEvaluator |
expressionEvaluator |
protected Map<Method,AutoOperateAnnotatedElement> |
methodCaches |
| 构造器和说明 |
|---|
MethodResultAutoOperateSupport() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
afterMethodInvoke(Method method,
Object result,
Object[] args)
After the method is called, process the returning result
of the method according to the configuration of
AutoOperate annotation. |
void |
destroy()
Clear resources when destroying the bean.
|
protected @NonNull AutoOperateAnnotatedElement |
resolveReturn(Method method)
Resolve the
AutoOperate annotation on the method |
protected final Map<Method,AutoOperateAnnotatedElement> methodCaches
protected final AutoOperateAnnotatedElementResolver elementResolver
protected final MethodBasedExpressionEvaluator expressionEvaluator
protected final AnnotationFinder annotationFinder
public void afterMethodInvoke(Method method, Object result, Object[] args)
AutoOperate annotation.method - methodresult - resultargs - argsprotected @NonNull AutoOperateAnnotatedElement resolveReturn(Method method)
AutoOperate annotation on the methodmethod - methodAutoOperateAnnotatedElement.EMPTYAutoOperateAnnotatedElement.EMPTYpublic void destroy()
Copyright © 2024. All rights reserved.