AspectJ: parameter in a pointcut

后端 未结 5 1232
说谎
说谎 2021-01-01 01:54

I\'m using AspectJ to advice all the public methods which do have an argument of a chosen class. I tried the following:

pointcut permissionCheckMethods(Sessi         


        
5条回答
  •  轮回少年
    2021-01-01 02:45

    How about:

    pointcut permissionCheckMethods(Session sess) : 
    (execution(public * *(..)) && args(.., sess));
    

    I guess this will match if last (or only) argument is of type Session. By swapping the positions of args you can also match first-or-only. But i don't know if matching any arbitrary position is possible.

提交回复
热议问题