Annotations - Define CFlow
The principles behind CFlow when using annotations is exactly the same as when using XML, all that is different is the way of defining it. @CFlowStackDef and @CFlowDef MyAspect contains a few @CFlowStackDef annotated fields: @CFlowStackDef (cflows={@CFlowDef(expr = "void POJO->method1()", called=true), @CFlowDef(expr = "void POJO->method2()", called=true), @CFlowDef(expr = "void POJO->method3()", called=true)}) public static CFlowStack cf123Before; The first one declares that method1, method2, and method3 should be in the call stack in that order. The next @CFlowStackDef (cflows={@CFlowDef(expr = "POJO->new()", called=true), @CFlowDef(expr = "void POJO->method3()", called=true)}) public static CFlowStack cf1ConAnd3; Says that the POJO constructor with an int parameter and method3 must be in the call stack in that order. As for Annotated composition and Annotated typedefs the fully qualified name of the @CFlowStackDef annotated field is used when we reference the CFlowStackDef by name. Again, the type CFlowStack is used as the type of the field for clarity, even though the actual type of the field is irrelevant.