## Implements/Implementing

Sometimes when using $instanceof{}, you might just be interested in the methods coming from the implemented interface. There are two keywords that can be used in place of a method expression to acheive this:

- $implements{} - matches the methods from the interface(s) listed, but ignores any super interfaces
- $implementing{} - matches the methods from the interface(s) listed AND their super interfaces

In this example ImplementsInterface extends ImplementsSuperInterface, and ImplementingInterface extends ImplementingSuperInterface.

    <aop>
       <interceptor class="implementz.TestInterceptor"/>
       <bind pointcut="execution(void $instanceof{implementz.ImplementsInterface}->$implements{implementz.ImplementsInterface}(..))">
          <interceptor-ref name="implementz.TestInterceptor"/>
       </bind>
       <bind pointcut="execution(void $instanceof{implementz.ImplementingInterface}->$implementing{implementz.ImplementingInterface}(..))">
          <interceptor-ref name="implementz.TestInterceptor"/>
       </bind>
    </aop>

So for these bindings we will intercept our POJO class on all the methods coming from ImplementsInterface, i.e. `methodsFromImplements()`, and all methods coming from ImplementingInterface and ImplementingInterface's super interfaces, i.e. `methodFromImplementingSuper()` and `methodFromImplementsSuper()`.

Note that if your class implements several interfaces, you can specify more than one interface in the $implements{}, $implementing{} list, as shown in this example pointcut expression:

       execution(void $instanceof{X}->$implementing{X,Y,Z}(..))

#### Running

To compile and run:

      $ ant

It will javac the files and then run the AOPC precompiler to manipulate the bytecode, then finally run the example. The output should read as follows:

    run:
         [java] --- POJO ---
         [java] --- POJO.methodFromImplements ---
         [java] <<< TestInterceptor intercepting
         [java] *** POJO methodFromImplements
         [java] >>> Leaving Trace
         [java] --- POJO.methodFromImplementingSuper (should not intercept) ---
         [java] *** POJO methodFromImplementsSuper
         [java] --- POJO.methodFromImplementing ---
         [java] <<< TestInterceptor intercepting
         [java] *** POJO methodFromImplementing
         [java] >>> Leaving Trace
         [java] --- POJO.methodFromImplementingSuper ---
         [java] <<< TestInterceptor intercepting
         [java] *** POJO methodFromImplementingSuper
         [java] >>> Leaving Trace
         [java] --- POJO.ownMethod (should not intercept) ---
         [java] *** POJO ownMethod