We have already worked with kinded pointcuts in the examples of the previous posts. But I haven’t explicitly explained what different types of kinded pointcuts exist and which join points they exactly capture. Here’s a list of the kinded pointcuts AspectJ provides:
> execution(MethodSignature/ConstructorSignature):
As you have probably already imagined this will capture the method or constructor execution matching the signature.
> call(MethodSignature/ConstructorSignature):
Such a pointcut captures the calls to methods matching the signature.
> get(FieldSignature):
This pointcut will capture the retrieval of the value of a field matching the signature.
> set(FieldSignature):
This will capture the write access to a field matching the signature.
> handler(TypeSignature):
This will capture executions of exception handlers.
Examples:
call(public * MyClass.*())
This would capture all calls to all public methods in the class MyClass that do not take any arguments.
set(private float MyClass.myField)
This would capture write access to the private field myField of the class MyClass.
These are the most common pointcuts. There do also exist pointcuts to capture the Object initialization and pre-initialization and so forth. But I won’t show them here.
