KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > aspect > DynamicallyCreatedAspect


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.definition.Pointcut;
12 import org.codehaus.aspectwerkz.definition.Pointcut;
13 import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
14
15 /**
16  * @author <a HREF="mailto:jboner@codehaus.org">Jonas BonŽr </a>
17  * @Aspect perJVM
18  */

19 public class DynamicallyCreatedAspect {
20     // ============ Pointcuts ============
21

22     /**
23      * @Expression execution(* test.DynamicDeploymentTest.createAspectTestMethod(..))
24      */

25     Pointcut pc1;
26
27     // ============ Advices ============
28

29     /**
30      * @Around pc1
31      */

32     public Object JavaDoc advice1(final JoinPoint joinPoint) throws Throwable JavaDoc {
33         ((Loggable) joinPoint.getTarget()).log("beforeNew ");
34         final Object JavaDoc result = joinPoint.proceed();
35         ((Loggable) joinPoint.getTarget()).log("afterNew ");
36         return result;
37     }
38 }
Popular Tags