Version 2

    Intercept everything

     

    All

    The all pointcut expression matches any constructor, method, or field execution of a particular class expression.

    <aop>
       <bind pointcut="all(POJO)">
           <interceptor class="SimpleInterceptor"></interceptor>
       </bind>
    </aop>
    

    The SimpleInterceptor will be called for the constructor, method, and field access in Driver.java

     

    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] --- new POJO(); ---
         [java] <<< Entering SimpleInterceptor type: org.jboss.aop.joinpoint.ConstructorInvocation
         [java] empty constructor
         [java] >>> Leaving SimpleInterceptor
         [java] --- pojo.someMethod(); ---
         [java] <<< Entering SimpleInterceptor type: org.jboss.aop.joinpoint.MethodInvocation
         [java] someMethod
         [java] >>> Leaving SimpleInterceptor
         [java] --- pojo.var++; ---
         [java] <<< Entering SimpleInterceptor type: org.jboss.aop.joinpoint.FieldReadInvocation
         [java] >>> Leaving SimpleInterceptor
         [java] <<< Entering SimpleInterceptor type: org.jboss.aop.joinpoint.FieldWriteInvocation
         [java] >>> Leaving SimpleInterceptor