1   /***************************************************************************************
2    * Copyright (c) Jonas Bonér, Alexandre Vasseur. All rights reserved.                 *
3    * http://aspectwerkz.codehaus.org                                                    *
4    * ---------------------------------------------------------------------------------- *
5    * The software in this package is published under the terms of the LGPL license      *
6    * a copy of which has been included with this distribution in the license.txt file.  *
7    **************************************************************************************/
8   package test.aspect;
9   
10  import test.Loggable;
11  import org.codehaus.aspectwerkz.Pointcut;
12  import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
13  
14  /***
15   * @author <a href="mailto:jboner@codehaus.org">Jonas Bonér </a>
16   * @Aspect perJVM
17   */
18  public class DynamicallyCreatedAspect {
19      // ============ Pointcuts ============
20  
21      /***
22       * @Expression execution(* test.DynamicDeploymentTest.createAspectTestMethod(..))
23       */
24      Pointcut pc1;
25  
26      // ============ Advices ============
27  
28      /***
29       * @Around pc1
30       */
31      public Object advice1(final JoinPoint joinPoint) throws Throwable {
32          ((Loggable) joinPoint.getTarget()).log("beforeNew ");
33          final Object result = joinPoint.proceed();
34          ((Loggable) joinPoint.getTarget()).log("afterNew ");
35          return result;
36      }
37  }