!!!Annotated Dynamic Control Flow

!Overview
Dynamic CFlows work similar to when defined in [XML|../dynamic_cflow/cflow.html]. The only difference is how to declare it using annotations.

!Implement DynamicCFlow
Take a look at {{SimpleDynamicCFlow}}:
{{{
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.pointcut.DynamicCFlow;
import org.jboss.aop.DynamicCFlowDef;

@DynamicCFlowDef
public class SimpleDynamicCFlow implements DynamicCFlow
{
   public static boolean runit = false;

   public boolean shouldExecute(Invocation invocation)
   {
      return runit;
   }
}
}}}

This is exactly the same as in the [XML|../dynamic_cflow/cflow.html] example. The only difference is that we declare the dynamic cflow class by annotating it with @DynamicCFlowDef.

!Use in bindings
You use the dynamic cflow in bindings exactly the same way as you would do with any other cflow (apart from this time we use the fully qualified name of the {{@DynamicCFlowDef}} annotated class). Here is the relevant bit of SimpleInterceptor:
{{{
   @InterceptorDef
   @Bind (pointcut="execution(void POJO->method1())", cflow="SimpleDynamicCFlow")
   public class SimpleInterceptor implements Interceptor
   {
      ...
   }
}}}

!Run the example
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.method4(); ---
    [java] method1
    [java] --- turn on cflow ---
    [java] <<< Entering SimpleInterceptor for: public void POJO.method1()
    [java] method1
    [java] >>> Leaving SimpleInterceptor

}}}

