我有一个method
注释:
@Around("execution(* it.foo.bar.Flow.*(..))")
public Object profile(ProceedingJoinPoint pjp) {...}
在Flow class
我switch
上有一个简单的enumeration type
。当我在那条线上跑时,上面的profile method
被调用。这是我pjp object
:
execution(int[] it.foo.bar.Flow.$SWITCH_TABLE$it$foo$bar$dataobjects$RequestType())
RequestType
是enum
。
我想避免在遇到profile method
时调用enum
,所以我尝试了几个执行表达式,但它没有工作,除了下面的一个,除了上面一个:
&& !(execution(int[] it.foo.bar.Flow.$SWITCH_TABLE$it$foo$bar$dataobjects$RequestType()))
是否有可能实现我的目标?
答案 0 :(得分:1)
不可能在比方法更细粒度的水平上编织类。您可以将RequestType
enum
处理的功能提取到单独的方法中,并调整切入点表达式以避免这种情况:
@Around("execution(* it.foo.bar.Flow.*(..)) && !execution(* it.foo.bar.Flow.handleRequestType(..))")