View Javadoc
1 package attrib4j; 2 3 import java.net.URLClassLoader; 4 5 import com.sun.javadoc.MethodDoc; 6 7 /*** 8 * A generic interface for inserting or storing attributes that will 9 * be associated with the class. 10 * 11 * @author <a href="mailto:mpollack@speakeasy.net"></a> 12 * @version $Revision: 1.6 $ $Date: 2003/04/24 05:41:55 $ 13 */ 14 public interface ClassAnnotator { 15 16 /*** 17 * Create the object that will be used to store the attribute. 18 * In current implementations this can be the object as created from the 19 * text, which in turn will be serialized into the .classfile (BCELFactory) 20 * or just the text itself (BCELTextFactory). 21 * 22 * @param text The string describing the attribute. 23 * @param classLoader The class loader user to resolve the attribute class 24 * @param attributePackages The list of package names to prefix the attribute 25 * search 26 * @return Object The attribute object for storage in the bytecode or elsewhere. 27 */ 28 Object createAttributeInstance( 29 String text, 30 URLClassLoader classLoader, 31 String[] attributePackages); 32 33 /*** 34 * Associate an attribute at the class level. 35 * 36 * @param attribute The attribute, should be serializable. 37 */ 38 void insertClassAttribute(Object attribute); 39 40 // void insertMethodAttribute(String methodName, String[] methodParamTypes, Object attribute); 41 42 /*** 43 * Associate an attribute at the method level. Uses the javadoc 44 * MethodDoc class as a way to define a particular method. 45 * 46 * TODO: Think about using classes from java.lang.reflect for describing 47 * the method. 48 * @param methodDoc The particular method in the class to associate an 49 * attribute. 50 * @param attribute The attribute, should be serializable. 51 */ 52 void insertMethodAttribute(MethodDoc methodDoc, Object attribute); 53 54 /*** 55 * Associate an attribute at the field level. 56 * 57 * @param field The name of the field. 58 * @param attribute The attribute, should be serializable. 59 */ 60 void insertFieldAttribute(String field, Object attribute); 61 62 /*** 63 * Do the work of writing all the meta-data to the new .class file. 64 * 65 * @param destDir where the new .class file will be located. 66 */ 67 void write(String destDir); 68 }

This page was automatically generated by Maven