|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--attrib4j.bcel.AbstractBCELClassAnnotator
Field Summary | |
protected org.apache.bcel.generic.ClassGen |
_classGen
|
protected org.apache.bcel.classfile.ConstantPool |
_constantPool
|
protected org.apache.bcel.generic.ConstantPoolGen |
_constantPoolGen
|
protected org.apache.bcel.classfile.JavaClass |
_javaClass
|
Constructor Summary | |
AbstractBCELClassAnnotator()
|
Method Summary | |
abstract 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. |
abstract byte[] |
createBytesFromAttribute(java.lang.Object attribute)
|
protected static java.lang.Class |
createFromPackageSearch(java.lang.String baseClassname,
java.net.URLClassLoader classloader,
java.lang.String[] attributePackages)
|
protected static java.lang.Object |
guessParam(java.lang.Class ctorParamType,
java.lang.String paramText)
Internal routine to guess (and create) the parameter instance from the text passed in and the type it's supposed to be (from the constructor). |
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. 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. |
protected static java.lang.String |
parseAttributeClassName(java.lang.String fullAttributeText)
Internal routine to pick out a classname from text looking something like: "@attribute attrib4j.examples.attributes.DebugAttribute(true, 12)" |
protected static java.lang.String[] |
parseAttributeParams(java.lang.String fullAttributeText)
Internal routine to pick out parameters from text looking something like "@attribute com.javageeks.attributes.DebugAttribute(true, 12)" |
void |
write(java.lang.String destDir)
Do the work of writing all the meta-data to the new .class file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected org.apache.bcel.generic.ClassGen _classGen
protected org.apache.bcel.classfile.ConstantPool _constantPool
protected org.apache.bcel.generic.ConstantPoolGen _constantPoolGen
protected org.apache.bcel.classfile.JavaClass _javaClass
Constructor Detail |
public AbstractBCELClassAnnotator()
Method Detail |
protected static java.lang.Class createFromPackageSearch(java.lang.String baseClassname, java.net.URLClassLoader classloader, java.lang.String[] attributePackages) throws AttributeException
AttributeException
protected static java.lang.Object guessParam(java.lang.Class ctorParamType, java.lang.String paramText)
ctorParamType
- The class of the positional parameter in the
attribute constructor.paramText
- The string value of this paramemter as given in
in the Javadoc tag.
protected static java.lang.String parseAttributeClassName(java.lang.String fullAttributeText)
fullAttributeText
- The text of the attribute javadoc tag.
protected static java.lang.String[] parseAttributeParams(java.lang.String fullAttributeText)
fullAttributeText
- The text of the attribute javadoc tag.
public abstract java.lang.Object createAttributeInstance(java.lang.String text, java.net.URLClassLoader classLoader, java.lang.String[] attributePackages)
ClassAnnotator
createAttributeInstance
in interface ClassAnnotator
text
- The string describing the attribute.classLoader
- The class loader user to resolve the attribute classattributePackages
- The list of package names to prefix the attribute
search
public abstract byte[] createBytesFromAttribute(java.lang.Object attribute)
public void insertClassAttribute(java.lang.Object attribute)
insertClassAttribute
in interface ClassAnnotator
attribute
- The attribute, should be serializable.ClassAnnotator.insertClassAttribute(java.lang.Object)
public void insertFieldAttribute(java.lang.String field, java.lang.Object attribute)
insertFieldAttribute
in interface ClassAnnotator
field
- The name of the field.attribute
- The attribute, should be serializable.ClassAnnotator.insertFieldAttribute(java.lang.String, java.lang.Object)
public void insertMethodAttribute(com.sun.javadoc.MethodDoc methodDoc, java.lang.Object attribute)
insertMethodAttribute
in interface ClassAnnotator
methodDoc
- The particular method in the class to associate an
attribute.attribute
- The attribute, should be serializable.ClassAnnotator.insertMethodAttribute(com.sun.javadoc.MethodDoc, java.lang.Object)
public void write(java.lang.String destDir)
ClassAnnotator
write
in interface ClassAnnotator
destDir
- where the new .class file will be located.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |