3

I am implementing an interface from an an aspect

declare parents: SomePackage.AClass+ extends InterfaceBelow

public interface InterfaceBelow() {
        //bunch of methods
}

I want a method which should return the class/instance implementing the interface itself. Something such as adding a method to the interface public Object getSelf() and then use AspectJ to implement it like this:

public InterfaceBelow.getSelf()
{
     //how to return the instance implementing the interface
}

I need to do it in the aspect not from the class and then {return this;}

1 Answers1

1

have InterfaceBelow.getSelf() return null. then create an around pointcut around that method. the pointcut can capture the target of the method invocation. return that instead.

aepurniet
  • 1,719
  • 16
  • 24