I covered the basics of AOP in my previous articles “AOP - Aspect Oriented Programming” and “AOP: Terms and AspectJ”. If you haven’t read them yet I’d suggest you to do this now. Otherwise just go on reading.
As I mentioned earlier pointcuts capture or identify join points. Named poincuts have the following syntax:
Syntax:
[access-specifier] pointcut pointcut-name([arguments]) : pointcut-type(signature)
Example:
public pointcut myPointcut() : execution(public void MyClass.myMethod())
You do use them in an advice as follows:
before() : myPointcut() {
…
}
Anonymous pointcuts are directly declared behind the “:”. It would then look like this:
before() : execution(public void MyClass.myMethod()) {
…
}
Well, that’s it for now. Easy, isn’t it? I will cover wildcards in my next article about AOP. And I hope that at the latest then you will recognize that AOP is a lot of fun. ![]()
