[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Params to Aspects?
|
Hello,
I have a family of aspects that are all identical except for an
"internal" name I want to uniquely assign to each aspect instance.
Rather than write one aspect class for each, I'd like to reuse one class
for all. So what I would like to do is something like this:
<aspectj>
<aspects>
<concrete-aspect name="$com.verisign.aspectj.Hello$Aspect"
extends="com.verisign.aspectj.AbstractAspect">
<pointcut name="scope" expression="execution(public *
*.hello(..))"/>
<param name="id" value="hello"/> <<<<<< THIS
</concrete-aspect>
<concrete-aspect
name="$com.verisign.aspectj.Goodbye$Aspect("goodbye")"
extends="com.verisign.aspectj.AbstractAspect"> <<<< OR THIS
<pointcut name="scope" expression="execution(public *
*.goodbye(..))"/>
</concrete-aspect>
</aspects>
<weaver>
<include within="com.verisign.something.*"/>
</weaver>
</aspectj>
In the above "hello world" example, the aspect would
"System.out.println(id);", or some such.
Is this sort of thing possible?
Alternatively, can one pass in a constructor argument to the named
concrete aspect from the XML definition?
Or, can one pass in arguments to the "scope" method that is generated?
Thanks in advance,
Bob