View Javadoc

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 org.codehaus.aspectwerkz.joinpoint;
9   
10  /***
11   * Implements the join point concept, e.g. defines a well defined point in the program flow.
12   * <p/>
13   * Provides access to only static data, is therefore much more performant than the usage of the {@link
14   * org.codehaus.aspectwerkz.joinpoint.JoinPoint} interface.
15   *
16   * @author <a href="mailto:jboner@codehaus.org">Jonas Bonér </a>
17   */
18  public interface StaticJoinPoint {
19      public static final String METHOD_EXECUTION = "METHOD_EXECUTION";
20      public static final String METHOD_CALL = "METHOD_CALL";
21      public static final String CONSTRUCTOR_EXECUTION = "CONSTRUCTOR_EXECUTION";
22      public static final String CONSTRUCTOR_CALL = "CONSTRUCTOR_CALL";
23      public static final String FIELD_SET = "FIELD_SET";
24      public static final String FIELD_GET = "FIELD_GET";
25      public static final String HANDLER = "HANDLER";
26      public static final String STATIC_INITIALIZATION = "STATIC_INITIALIZATION";
27  
28      /***
29       * Walks through the pointcuts and invokes all its advices. When the last advice of the last pointcut has been
30       * invoked, the original method is invoked. Is called recursively.
31       *
32       * @return the result from the next invocation
33       * @throws Throwable
34       */
35      Object proceed() throws Throwable;
36  
37      /***
38       * Clones the join point instance.
39       *
40       * @return the cloned join point instance
41       */
42      StaticJoinPoint deepCopy();
43  
44      /***
45       * Returns metadata matchingn a specfic key.
46       *
47       * @param key the key to the metadata
48       * @return the value
49       */
50      Object getMetaData(Object key);
51  
52      /***
53       * Adds metadata.
54       *
55       * @param key   the key to the metadata
56       * @param value the value
57       */
58      void addMetaData(Object key, Object value);
59  
60      /***
61       * Returns the signature for the join point.
62       *
63       * @return the signature
64       */
65      Signature getSignature();
66  
67      /***
68       * Returns the callee instance.
69       *
70       * @return the callee instance
71       */
72      Object getCallee();
73  
74      /***
75       * Returns the caller instance.
76       *
77       * @return the caller instance
78       */
79      Object getCaller();
80  
81      /***
82       * Returns the 'this' instance (the one currently executing).
83       *
84       * @return 'this'
85       */
86      Object getThis();
87  
88      /***
89       * Returns the target instance. If the join point is executing in a static context it returns null.
90       *
91       * @return the target instance
92       */
93      Object getTarget();
94  
95      /***
96       * Returns the caller class.
97       *
98       * @return the caller class
99       */
100     Class getCallerClass();
101 
102     /***
103      * Returns the target class.
104      *
105      * @return the target class
106      */
107     Class getTargetClass();
108 
109     /***
110      * Returns the join point type.
111      *
112      * @return the type
113      * @TODO: should return an Enum and not an untyped string
114      */
115     String getType();
116 }