public class MethodInfo extends Object
newCodeBuilder()
to obtain a CodeBuilder
instance for adding instructions to this
method.ClassFile
,
CodeBuilder
Modifier and Type | Method and Description |
---|---|
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.
|
CodeBuilder |
newCodeBuilder()
Returns a new CodeBuilder instance for adding instructions to this
method.
|
CodeBuilder |
newCodeBuilder(boolean saveLineNumberInfo,
boolean saveLocalVariableInfo)
Returns a new CodeBuilder instance for adding instructions to this
method.
|
void |
setModifiers(Modifiers modifiers) |
String |
toString() |
void |
writeTo(DataOutput dout) |
public CodeBuilder newCodeBuilder()
public CodeBuilder newCodeBuilder(boolean saveLineNumberInfo, boolean saveLocalVariableInfo)
saveLineNumberInfo
- When set false, all calls to CodeBuilder.mapLineNumber(int)
are ignored. By default, this value is true.saveLocalVariableInfo
- When set true, all local variable usage
information is saved in the ClassFile. By default, this value is false.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
Copyright © 2004-2015 Cojen. All Rights Reserved.