1

メソッド変数の値を一度/傍受されている間に抽出することは可能ですか? パラメータをインターセプトしたくないのですが、メソッド内の属性値をインターセプトしたくありませんか? 例えば

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

}

}

ありがとう

4

1 に答える 1