perthis/pertarget - use those when you want to associate extra state
with an object in the system.  That is easier than maintaining a map
in a singleton aspect that maps from the object to some 'extra state
holding' object.

percflow/percflowbelow - similarly this is when you just want extra
state to live for a particular control flow.  Perhaps some kind of
request context.  It can be used instead of a ThreadLocal (or a
singleton Map)

The book 'Eclipse AspectJ' includes some examples, and I dare say
Ramnivas' book does too (AspectJ in Action).

You might ask, for a perthis aspect, why use that rather than an ITD -
well the ITD affects *all* the objects of that type in the system
whereas the perthis aspect will only be 'augmenting' those that match
the specified pointcut.

cheers,
Andy

On 18 December 2011 04:59, Mark <[email protected]> wrote:
> Are there any examples demonstrating how these aspect instantiation modes
> help solve any painful issues?
>
> Thanks.
>
> --
> View this message in context: 
> http://aspectj.2085585.n4.nabble.com/Aspect-instantiation-modes-perthis-pertarget-percflow-percflowbelow-what-is-the-motivation-for-there-tp4210726p4210726.html
> Sent from the AspectJ - users mailing list archive at Nabble.com.
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to