public interface DynamicCFlow { boolean shouldExecute(Invocation invocation); }
Put in the logic you want to run at runtime into the shouldExecution method.
<dynamic-cflow name="simple" class="SimpleDynamicCFlow"/>
Then you can use the dynamic cflow in any cflow expression. The cflow will be allocate once and only once for the entire VM.
public interface XmlLoadable { public void importXml(Element element); }
THIS EXAMPLE REQUIRES JDK 5!! For other options, please look at the non-annotated examples guide To compile and run:
$ run.aopc.50
It will javac the files and then run the AOPC precompiler to manipulate the bytecode, then finally run the example. The output should be similar to this:
_run.aopc.50: [java] --- pojo.method4(); --- [java] method1 [java] --- turn on cflow --- [java] <<< Entering SimpleInterceptor for: public void POJO.method1() [java] method1 [java] >>> Leaving SimpleInterceptor