01: /**************************************************************************************
02: * Copyright (c) Jonas Bon?r, Alexandre Vasseur. All rights reserved. *
03: * http://aspectwerkz.codehaus.org *
04: * ---------------------------------------------------------------------------------- *
05: * The software in this package is published under the terms of the LGPL license *
06: * a copy of which has been included with this distribution in the license.txt file. *
07: **************************************************************************************/package examples.annotation;
08:
09: import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
10:
11: /**
12: * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur</a>
13: */
14: public class Target {
15:
16: public static void main(String args[]) throws Throwable {
17: System.out.println("examples.annotation.Target.main");
18: Target me = new Target();
19: me.targetAB();
20: me.targetA();
21: me.target();
22: }
23:
24: /**
25: * @examples.annotation.AnnotationA(some)
26: * @examples.annotation.AnnotationB
27: */
28: public void targetAB() {
29: System.out.println("Target.target AB ");
30: }
31:
32: /**
33: * @examples.annotation.AnnotationA
34: */
35: public void targetA() {
36: System.out.println("Target.target A");
37: }
38:
39: public void target() {
40: System.out.println("Target.target");
41: }
42:
43: public static class AnnotationMatchAspect {
44:
45: /**
46: * @param jp
47: * @Before execution(@examples.annotation.AnnotationA * examples.annotation.Target.*(..))
48: */
49: public void beforeA(JoinPoint jp) {
50: System.out
51: .println("Target$AnnotationMatchAspect.beforeA : "
52: + jp.toString());
53:
54: }
55:
56: /**
57: * @param jp
58: * @Before execution(@examples.annotation.AnnotationB * examples.annotation.Target.*(..))
59: */
60: public void beforeB(JoinPoint jp) {
61: System.out.println("Target$AnnotationMatchAspect.beforeB");
62:
63: }
64: }
65:
66: }
|