I am trying to use Spring framework to dynamically implement a specific interface (lets call it I) for a class (let call it C). In Spring this is called introduction (mixin in other languages). In compile time C doesn't implement I. Using the @DeclareParents annotation I can do it in AspectJ syntax.
The problem is that the actual implementation of I (lets call it IImpl) is standalone (not dependent on the context) - I should only supply the IImpl class name in the annotation. What I want to achieve is the implementation that is stipulated in some way. For example, I would like to provide the IImpl instance with a parameter, say the enclosing C instance, so that the logic in IImpl would be different depending on what instance of C I am introducing. I need some way to set the dependecy between the IImpl instance and the introduced C instance.
Currently I cannot find a way to do it. Any ideas?
Thanks.