是否可以一次/在拦截方法变量时提取它的值?我不想截取参数而是方法中的属性值?例如
Business Logic:
@MyInterceptor
void myMethod(Object o){
ArrayList myList= null;
myList= dao.getRecords(o.getId) //intercept the result of this dao call
//I only want to call doWork after I have 'validated' contents of myList in interceptor
doWork(myList)
}
The Interceptor:
@Interceptor
@MyInterceptor
MyInterceptor{
@AroundInvoke{
public Object invoke(InvocationContext ctx) throws Exception {
//retrieve the contents of myList above and perform validation
//if it passes validation call ctx.proceed else return error
}
}
谢谢