01: package examples.introduction;
02:
03: import org.codehaus.aspectwerkz.AspectContext;
04:
05: import java.io.Serializable;
06:
07: /**
08: * @Aspect perClass
09: */
10: public class IntroductionAspect extends AbstractIntroductionAspect {
11:
12: /**
13: * @Introduce within(examples.introduction.Target)
14: */
15: public Serializable serializable;
16:
17: /**
18: * @Mixin(pointcut="within(@Annotation *..*)", deploymentModel="perInstance")
19: */
20: public static class MyConcreteImpl extends MyImpl {
21:
22: /**
23: * The instance we are introduced to since we are perInstance
24: */
25: private final Object m_target;
26:
27: /**
28: * @param target
29: */
30: public MyConcreteImpl(final Object target) {
31: m_target = target;
32: System.out
33: .println("--Accessing mixin target instance from the mixin <init>...");
34: System.out.println("-- I am introduced to " + target);
35: sayHello2();
36: System.out.println("--..<init> done");
37: }
38:
39: public String sayHello2() {
40: return "Hello World! Hello World!";
41: }
42: }
43: }
|