I would rather use a factory for instantiating objects in a clean way which 
helps to avoid duplicate equal instances.

And BTW, I do hope that long-living entities like bank accounts persist their 
status anyway. Anything else would be a design flaw in your application. 
Anyway, you can still use the Map approach to keep track of object 
instantiation and verify that object life cycles are actually as you expect 
them to be.

The other way around might also work: use perthis/pertarget for each instance, 
but a global map to track the status of equal instances.

Alexander Kriegisch

Am 17.01.2013 um 10:16 schrieb ccol002 <[email protected]>:

> The intention is to keep track of the behaviour of object with a long life
> span. For example checking that a bank account object follows a particular
> life cycle (ie sequence of method calls). Yes, if A goes out of scope and B
> appears (and A.equals(B)), then the aspect should still remember the
> behaviour of A and continue with tracking B's behaviour. 
> I agree that probably the best (and only) way to do it is to use a Map but
> was wondering if perthis/pertarget could be useful. 
> 
> 
> 
> --
> View this message in context: 
> http://aspectj.2085585.n4.nabble.com/perthis-pertarget-taking-into-consideration-the-equals-method-tp4650723p4650726.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