Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] perthis/pertarget taking into consideration the "equals" method

It depends on what you actually want to do. What is the intention behind perthis/pertarget? Which kind of state do you want to keep for each equal set of objects? Which joinpoints do you want to match and what should your advice do? And what should happen if object A goes out of scope and gets garbage-collected and then later an equal object B is created? This might have implications on an alternative implementation using a Map (maybe a WeakHashMap) to record your objects within a singleton aspect. There is too much speculation and not enough facts here. Please give us more details.

Alexander Kriegisch


Am 16.01.2013 um 15:04 schrieb ccol002 <chriscol002@xxxxxxxxx>:
 
> I am trying to associate an aspect per object but taking into consideration
> the "equals" method,
> i.e. if a.equals(b) then a and b share the same aspect. 
> 
> My approach is to use a unique "wrapper" object for both a and b and apply
> the perthis/pertarget on the "wrapper". 
> 
> Is there a smarter way of doing this?


Back to the top