|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.cojen.classfile.MethodInfo
public class MethodInfo
This class corresponds to the method_info data structure as defined in section 4.6 of The Java Virtual Machine Specification. To make it easier to create bytecode for a method's CodeAttr, the CodeBuilder class is provided.
ClassFile
,
CodeBuilder
Method Summary | |
---|---|
void |
addAttribute(Attribute attr)
|
void |
addException(TypeDesc type)
Add a declared exception that this method may throw. |
ClassFile |
addInnerClass(String innerClassName)
Add an inner class to this method. |
ClassFile |
addInnerClass(String innerClassName,
Class superClass)
Add an inner class to this method. |
ClassFile |
addInnerClass(String innerClassName,
String superClassName)
Add an inner class to this method. |
Annotation |
addRuntimeInvisibleAnnotation(TypeDesc type)
Add a runtime invisible annotation. |
Annotation |
addRuntimeVisibleAnnotation(TypeDesc type)
Add a runtime visible annotation. |
Attribute[] |
getAttributes()
|
ClassFile |
getClassFile()
Returns the parent ClassFile for this MethodInfo. |
CodeAttr |
getCodeAttr()
Returns a CodeAttr object used to manipulate the method code body, or null if this method is abstract or native. |
ConstantUTFInfo |
getDescriptorConstant()
Returns a constant from the constant pool with this method's type descriptor string. |
TypeDesc[] |
getExceptions()
Returns the exceptions that this method is declared to throw. |
int |
getLength()
Returns the length (in bytes) of this object in the class file. |
MethodDesc |
getMethodDescriptor()
Returns a MethodDesc which describes return and parameter types of this method. |
Modifiers |
getModifiers()
Returns this method's modifiers. |
String |
getName()
Returns the name of this method. |
ConstantUTFInfo |
getNameConstant()
Returns a constant from the constant pool with this method's name. |
Annotation[] |
getRuntimeInvisibleAnnotations()
Returns all the runtime invisible annotations defined for this class file, or an empty array if none. |
Annotation[] |
getRuntimeVisibleAnnotations()
Returns all the runtime visible annotations defined for this class file, or an empty array if none. |
SignatureAttr |
getSignatureAttr()
Returns the signature attribute of this method, or null if none is defined. |
boolean |
isDeprecated()
|
boolean |
isSynthetic()
|
void |
markDeprecated()
Mark this method as being deprecated by adding a special attribute. |
void |
markSynthetic()
Mark this method as being synthetic by adding a special attribute. |
void |
setModifiers(Modifiers modifiers)
|
String |
toString()
|
void |
writeTo(DataOutput dout)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public ClassFile getClassFile()
public String getName()
public MethodDesc getMethodDescriptor()
public Modifiers getModifiers()
public void setModifiers(Modifiers modifiers)
public ConstantUTFInfo getNameConstant()
public ConstantUTFInfo getDescriptorConstant()
MethodDesc
public TypeDesc[] getExceptions()
public CodeAttr getCodeAttr()
public boolean isSynthetic()
public boolean isDeprecated()
public Annotation[] getRuntimeInvisibleAnnotations()
public Annotation[] getRuntimeVisibleAnnotations()
public Annotation addRuntimeInvisibleAnnotation(TypeDesc type)
public Annotation addRuntimeVisibleAnnotation(TypeDesc type)
public SignatureAttr getSignatureAttr()
public void addException(TypeDesc type)
public ClassFile addInnerClass(String innerClassName)
innerClassName
- Optional short inner class name.public ClassFile addInnerClass(String innerClassName, Class superClass)
innerClassName
- Optional short inner class name.superClass
- Super class.public ClassFile addInnerClass(String innerClassName, String superClassName)
innerClassName
- Optional short inner class name.superClassName
- Full super class name.public void markSynthetic()
public void markDeprecated()
public void addAttribute(Attribute attr)
public Attribute[] getAttributes()
public int getLength()
public void writeTo(DataOutput dout) throws IOException
IOException
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |