Aspectj defaultcutcut pointcut
I'm working with some AspectJ code and I want to catch all executions without any personal pointcuts.
@Pointcut("execution(public * *(..))")//Public
public void publicMethod(){};
@Pointcut("execution(protected * *(..))"//Protected
public void protectedMethod(){}
@Pointcut("@annotation(mypackage.name.annotationName")
public void annotationPointcut(){}
@Around("annotationPointcut() && (protectedMethod() || publicMethod())")
public Object test(){ System.out.println("Should not print private"); }
I read about using! (no) but couldn't get it to work. Something like
@Pointcut("!execution(private * *(..))"
But not getting it to work.
I couldn't find the modifier name for the default class modifier in aspectJ, I missed it or I need to try and solve it using! not subscribe in some way?
Refers to a new developer who is learning aspectJ
+3
source to share