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.annotation.instrumentation;
9   
10  import java.lang.reflect.Method;
11  
12  /***
13   * Methods that should be implemented in order to extract attributes associate with a class. <p/>An implementation this
14   * class needs to be provided for each bytecode manipulation library or other meta-data storage mechanism that is
15   * supported.
16   * 
17   * @author <a href="mailto:jboner@codehaus.org">Jonas Bonér </a>
18   */
19  public interface AttributeExtractor {
20      public static final Object[] EMPTY_OBJECT_ARRAY = new Object[] {};
21  
22      /***
23       * Retreives attributes associated with the class.
24       * 
25       * @return An array of attributes that satisfy the instanceof comparison with the filter class. Null if there are no
26       *         attributes associated with the class.
27       */
28      Object[] getClassAttributes();
29  
30      /***
31       * Retreives custom attributes applied to a specific method of the class.
32       * 
33       * @param methodName The name of the method.
34       * @param methodParamTypes The signature of the method.
35       * @return An array of custom attributes. Null if there are no attributes.
36       */
37      Object[] getMethodAttributes(String methodName, String[] methodParamTypes);
38  
39      /***
40       * Return all the attributes associated with a constructor that have a particular method signature.
41       * 
42       * @param constructorParamTypes An array of parameter types as given by the reflection api.
43       * @return the constructor attributes.
44       */
45      Object[] getConstructorAttributes(String[] constructorParamTypes);
46  
47      /***
48       * Retreives custom attributes applied to a specific field of the class.
49       * 
50       * @param fieldName the name of a class field.
51       * @return An array of custom attributes. Null if there are no attributes.
52       */
53      Object[] getFieldAttributes(String fieldName);
54  }