如何在aspectJ中排除getter和setter? [英] How can I exclude getters and setters in aspectJ?
问题描述
我在我的maven项目中有一个class aspectJ,让我在项目中显示任何被调用方法的Begin和End。
我现在尝试排除所有的getter和setter。
我尝试修改此注释:
@Around(执行(公共* *(..))
by
@Around(执行(公* *(...)&&!in(* set *(..)))
I have a class aspectJ in my maven project whitch hepls me to show the Begin and the End of any called method in my project.
I try now to exclude all getters and setters.
I try modify this annotation:
@Around("execution(public * *(..))
by
@Around("execution(public * *(..) && !within(* set*(..))")
但它没有whork,它给了我在consol中:
But it doesn't whork and it gives me that in the consol:
[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.7:compile (default) on project spb-lceb: AJC compiler errors:
[ERROR] error at @Around("execution(public * *(..) && !within(* set*(..))")
Syntax error on token "execution(public * *(..) && !within(* set*(..))", ")" expected
任何想法
推荐答案
我认为这只是一个错字,因为你在执行调用结束前有一个mising )
&&
运营商:
I think it's only a typo because you have a mising )
at the end of the execution call before the &&
operator:
@Around("execution(public * *(..) && !within(* set*(..))")
应该是:
@Around("execution(public * *(..)) && !within(* set*(..))")
尝试一下,应该做的伎俩。
Try it, that should do the trick.
对于以获取开头的方法,最佳解决方案是重命名它们以消除此冲突。
And for the methods that begins with Get the best solution is to rename them to get rid of this conflict.
这篇关于如何在aspectJ中排除getter和setter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!