[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Exposing state held in method annotations
|
Not tried, but the following should work:
pointcut constantArgumentMethods(ConstantArguments annot)
: call(@ConstantArguments * *.*(..))
&& @annotation(annot);
Then inside advice, you may access the value property of the "annot" context:
before(ConstantArguments annot) : constantArgumentMethods(annot) {
System.out.println("Value is : " + annot.value());
}
Eric Bodden wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all.
Today I came across an annotation problem which I don't know how to
solve:
I have a method annotated like this:
@ConstantArguments({1}) public int foo(Wrapper a) {
..
}
Now I am matching on calls to it like this:
pointcut constantArgumentMethods() : call(@ConstantArguments *
*.*(..));
But how can I expose the "value" state "{1}" that I passed in above?
The following does *not* work:
pointcut constantArgumentMethods(int[] value) :
call(@ConstantArguments(value) * *.*(..));
I guess @target will not help, since it returns annotations of the
target *type*, not *method*, or am I wrong?
Cheers,
Eric
P.S. Definition of the ynnotation type:
public @interface ConstantArguments {
int[] value() default {};
}
- --
Eric Bodden
Chair I2 for Programming Languages and Program Analysis
RWTH Aachen University
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0.3
iQA/AwUBQfkyNMwiFCm7RlWCEQJUvwCdF6oPnnOj0IOrwgK3oqBFsEG+f+EAn1lW
n+BcQ4OfJRo3KlGuMlt7q+3Y
=IJhX
-----END PGP SIGNATURE-----
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users