
[英]Is there a way to write a pointcut for a getter to an annotated field?
[英]Is there a way to improve this pointcut?
我提出了以下用于跟踪方法进入/退出的切入点。 它没有坏,也可以满足我的要求,但是:1-我觉得它看起来笨拙或更优雅; 和2-我不知道它是否防弹。
// tracing the execution of all methods except:
// - toString and descendants
// - methods identified with @NotTraced and descendants
pointcut theMethod() :
within(*.*) &&
!within(tracing.*)
&& execution(* *(..))
&& !adviceexecution()
&& !cflow(adviceexecution())
&& !execution( String *.toString() )
&& !cflow(execution( String *.toString() ))
&& !execution( @NotTraced * *(..) )
&& !cflow(execution( @NotTraced * *(..) ));
有什么想法吗?
它要复杂得多。
我将其分为两部分:
然后,您可以使用&&
在同一方面使用两个切入点。
这样,如果您需要在其他位置使用其中之一,则可以具有更大的灵活性。
我将非常简单地开始,并在Eclipse中使用AJDT来监视受影响的联接点,以获取所需的最低限度。
现在,这里似乎有多余的地方,例如!adviceexecution()
和!cflow(adviceexecution)
,因为您在三个不同的地方重复了cflow和执行。
AJDT将成为您的朋友,例如,因为很难准确说出您可能想要排除的内容。
使其非常简单,以避免任何不良影响。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.