We do some of this in our caching framework by replacing the field with a proxy.
I haven't tested it yet, but you should be able to apply a caller pointcut, although you wouldn't be able to say "for this field I want to intercept this method", but you could say, that "I want to intercept this class and method from within this other class and method."
> We do some of this in our caching framework by
> replacing the field with a proxy.
This replacement, is it done by JBoss AOP, or manually?
> I haven't tested it yet, but you should be able to
> apply a caller pointcut
That would be a solution, though it may not always be practical, as sometimes I have no idea who is calling my objects :-)
Exactly. It is not always practical.....
Another feature of Javassist, is that you can replace all references of one class with another. We may use this feature so that we can make system classes like the collection api Adviseable.
I also want to research how AspectJ and/or AspectWerkz can describe this sort of scenario. Where you want to be able to intercept a method of a particular field of a particular class. This is definately implementable with Javassist and the current AOP framework, I would just like to know the best syntax to do this in.