'. '

Talk:AOP

From APIDesign

(Difference between revisions)
Jump to: navigation, search
(Comment provided by btilford - via ArticleComments extension)
Line 17: Line 17:
e.g.
e.g.
 +
<source lang="java">
@Around("@annotation(com.mycompany.BoundProp)")
@Around("@annotation(com.mycompany.BoundProp)")
 +
</source>
would match all methods annotated with @com.mycompany.BoundProp
would match all methods annotated with @com.mycompany.BoundProp
and you could still say only setters with 1 argument should be bound (since it might make sense to do that)
and you could still say only setters with 1 argument should be bound (since it might make sense to do that)
 +
<source lang="java">
@Around("@annotation(com.mycompany.BoundProp) && execution(public * *..*.set*(*))")
@Around("@annotation(com.mycompany.BoundProp) && execution(public * *..*.set*(*))")
 +
</source>
--btilford 01:45, 19 November 2009 (CET)
--btilford 01:45, 19 November 2009 (CET)
</div>
</div>
 +
 +
Thanks for your comment btilford. I did not know this. Still, this is slightly opposite approach. The end user still needs to deal with aspect and with meaning of ''@Around'' and pointcut ''public * *..*.set*(*))'' and setup the AspectJ compiler. I'm seeking for the possite: The user downloads library with ''com.mycompany.BoundProp'' annotations, applies the annotation to one of its classes and as a result all the setters in the class will become bounded. This is not big shift technologically, I guess, but huge improvement in ease of use. Not talking about the fact that it opens the door to create a market of reusable aspects.
 +
 +
--[[User:JaroslavTulach|JaroslavTulach]] 08:46, 19 November 2009 (UTC)

Revision as of 08:46, 19 November 2009

Comments on AOP <comments />


NicolasDumoulin said ...

We use aspectj for defining and using an aspect that serve an automatic objects caching service. It's not so hard, you can see our notes here: http://www.simexplorer.org/wiki/DevDoc/AspectJ

--NicolasDumoulin 13:00, 13 November 2009 (CET)

btilford said ...

AspectJ supports annotations pretty well plus you still have all the old methods of defining a pointcut (or combination) if you need to really specific.

e.g.

@Around("@annotation(com.mycompany.BoundProp)")

would match all methods annotated with @com.mycompany.BoundProp

and you could still say only setters with 1 argument should be bound (since it might make sense to do that)

@Around("@annotation(com.mycompany.BoundProp) && execution(public * *..*.set*(*))")


--btilford 01:45, 19 November 2009 (CET)

Thanks for your comment btilford. I did not know this. Still, this is slightly opposite approach. The end user still needs to deal with aspect and with meaning of @Around and pointcut public * *..*.set*(*)) and setup the AspectJ compiler. I'm seeking for the possite: The user downloads library with com.mycompany.BoundProp annotations, applies the annotation to one of its classes and as a result all the setters in the class will become bounded. This is not big shift technologically, I guess, but huge improvement in ease of use. Not talking about the fact that it opens the door to create a market of reusable aspects.

--JaroslavTulach 08:46, 19 November 2009 (UTC)

Personal tools
buy