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 com.thoughtworks.qdox.model.JavaField;
11 import com.thoughtworks.qdox.model.JavaMethod;
12
13 import java.net.URL;
14
15 /***
16 * Enhances a classes with attributes.
17 *
18 * @author <a href="mailto:jboner@codehaus.org">Jonas Bonér </a>
19 */
20 public interface AttributeEnhancer {
21 /***
22 * The name of the AspectWerkz custom attributes.
23 */
24 public static final String CUSTOM_ATTRIBUTE = "org.codehaus.aspectwerkz.custom_attribute";
25
26 /***
27 * Initializes the attribute enhancer. <p/>Must always be called before use.
28 *
29 * @param className the class name
30 * @param classPath the class path
31 * @return true if the class was succefully loaded, false otherwise
32 */
33 boolean initialize(String className, URL[] classPath);
34
35 /***
36 * Inserts an attribute on class level.
37 *
38 * @param attribute the attribute
39 */
40 void insertClassAttribute(Object attribute);
41
42 /***
43 * Inserts an attribute on field level.
44 *
45 * @param field the QDox java field
46 * @param attribute the attribute
47 */
48 void insertFieldAttribute(JavaField field, Object attribute);
49
50 /***
51 * Inserts an attribute on constructor level.
52 *
53 * @param method the QDox java method
54 * @param attribute the attribute
55 */
56 void insertConstructorAttribute(JavaMethod method, Object attribute);
57
58 /***
59 * Inserts an attribute on method level.
60 *
61 * @param method the QDox java method
62 * @param attribute the attribute
63 */
64 void insertMethodAttribute(JavaMethod method, Object attribute);
65
66 /***
67 * Writes the enhanced class to file.
68 *
69 * @param destDir the destination directory
70 */
71 void write(String destDir);
72
73 /***
74 * Return the first interfaces implemented by a level in the class hierarchy (bottom top).
75 *
76 * @return nearest superclass (including itself) ' implemented interfaces
77 */
78 String[] getNearestInterfacesInHierarchy(String innerClassName);
79 }