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