Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Params to Aspects?

You might also consider using a template language.. depending on your needs
you could use something as simple as XSLT, frame technology, etc or
something more sophisticated like Xpand in OpenArchitectureWare (though that
is more linked with MDD and creation of DSLs I suppose).

www.codegeneration.net has some good pointers.

 

 

> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-
> bounces@xxxxxxxxxxx] On Behalf Of Buck, Robert
> Sent: 15 March 2008 14:10
> To: aspectj-users@xxxxxxxxxxx
> Subject: [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(&quot;goodbye&quot;)"
> 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
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top