attrib4j
Interface ClassAnnotator

All Known Implementing Classes:
AbstractBCELClassAnnotator, CFParseClassAnnotator

public interface ClassAnnotator

A generic interface for inserting or storing attributes that will be associated with the class.

Version:
$Revision: 1.6 $ $Date: 2003/04/24 05:41:55 $
Author:

Method Summary
 java.lang.Object createAttributeInstance(java.lang.String text, java.net.URLClassLoader classLoader, java.lang.String[] attributePackages)
          Create the object that will be used to store the attribute.
 void insertClassAttribute(java.lang.Object attribute)
          Associate an attribute at the class level.
 void insertFieldAttribute(java.lang.String field, java.lang.Object attribute)
          Associate an attribute at the field level.
 void insertMethodAttribute(com.sun.javadoc.MethodDoc methodDoc, java.lang.Object attribute)
          Associate an attribute at the method level.
 void write(java.lang.String destDir)
          Do the work of writing all the meta-data to the new .class file.
 

Method Detail

createAttributeInstance

public java.lang.Object createAttributeInstance(java.lang.String text,
                                                java.net.URLClassLoader classLoader,
                                                java.lang.String[] attributePackages)
Create the object that will be used to store the attribute. In current implementations this can be the object as created from the text, which in turn will be serialized into the .classfile (BCELFactory) or just the text itself (BCELTextFactory).

Parameters:
text - The string describing the attribute.
classLoader - The class loader user to resolve the attribute class
attributePackages - The list of package names to prefix the attribute search
Returns:
Object The attribute object for storage in the bytecode or elsewhere.

insertClassAttribute

public void insertClassAttribute(java.lang.Object attribute)
Associate an attribute at the class level.

Parameters:
attribute - The attribute, should be serializable.

insertMethodAttribute

public void insertMethodAttribute(com.sun.javadoc.MethodDoc methodDoc,
                                  java.lang.Object attribute)
Associate an attribute at the method level. Uses the javadoc MethodDoc class as a way to define a particular method. TODO: Think about using classes from java.lang.reflect for describing the method.

Parameters:
methodDoc - The particular method in the class to associate an attribute.
attribute - The attribute, should be serializable.

insertFieldAttribute

public void insertFieldAttribute(java.lang.String field,
                                 java.lang.Object attribute)
Associate an attribute at the field level.

Parameters:
field - The name of the field.
attribute - The attribute, should be serializable.

write

public void write(java.lang.String destDir)
Do the work of writing all the meta-data to the new .class file.

Parameters:
destDir - where the new .class file will be located.


Copyright © 2002-2003 Mark Pollack. All Rights Reserved.