public class MethodInfo extends MemberInfo
| Modifier and Type | Field and Description |
|---|---|
static boolean |
doPreverify
If this value is true, Javassist maintains a
StackMap attribute
generated by the preverify tool of J2ME (CLDC). |
static String |
nameClinit
The name of class initializer (static initializer):
<clinit>. |
static String |
nameInit
The name of constructors:
<init>. |
| Constructor and Description |
|---|
MethodInfo(ConstPool cp,
String methodname,
MethodInfo src,
Map<?,?> classnameMap)
Constructs a copy of
method_info structure. |
MethodInfo(ConstPool cp,
String methodname,
String desc)
Constructs a
method_info structure. |
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(AttributeInfo info)
Appends an attribute.
|
int |
getAccessFlags()
Returns access flags.
|
CodeAttribute |
getCodeAttribute()
Returns a Code attribute.
|
ConstPool |
getConstPool()
Returns a constant pool table used by this method.
|
String |
getDescriptor()
Returns a method descriptor.
|
ExceptionsAttribute |
getExceptionsAttribute()
Returns an Exceptions attribute.
|
int |
getLineNumber(int pos)
Returns the line number of the source line corresponding to the specified
bytecode contained in this method.
|
String |
getName()
Returns a method name.
|
String |
getSignature() |
boolean |
isConstructor()
Returns true if this is a constructor.
|
boolean |
isMethod()
Returns true if this is not a constructor or a class initializer (static
initializer).
|
boolean |
isStaticInitializer()
Returns true if this is a class initializer (static initializer).
|
void |
removeCodeAttribute()
Removes a Code attribute.
|
void |
removeExceptionsAttribute()
Removes an Exception attribute.
|
void |
setAccessFlags(int acc)
Sets access flags.
|
void |
setCodeAttribute(CodeAttribute cattr)
Adds a Code attribute.
|
void |
setDescriptor(String desc)
Sets a method descriptor.
|
void |
setExceptionsAttribute(ExceptionsAttribute cattr)
Adds an Exception attribute.
|
void |
setName(String newName)
Sets a method name.
|
void |
setSuperclass(String superclass)
Changes a super constructor called by this constructor.
|
String |
toString()
Returns a string representation of the object.
|
equals, getAnnotation, getAnnotations, getAttribute, getAttributes, hasAnnotation, hashCodepublic static boolean doPreverify
StackMap attribute
generated by the preverify tool of J2ME (CLDC). The initial
value of this field is false.public static final String nameInit
<init>.public static final String nameClinit
<clinit>.public MethodInfo(ConstPool cp, String methodname, String desc)
method_info structure. The initial value of
access_flags is zero.cp - a constant pool tablemethodname - method namedesc - method descriptorDescriptorpublic MethodInfo(ConstPool cp, String methodname, MethodInfo src, Map<?,?> classnameMap) throws BadBytecode
method_info structure. Class names
appearing in the source method_info are renamed according
to classnameMap.
Note: only Code and Exceptions attributes
are copied from the source. The other attributes are ignored.
cp - a constant pool tablemethodname - a method namesrc - a source method_infoclassnameMap - specifies pairs of replaced and substituted name.BadBytecodeDescriptorpublic String toString()
public String getSignature()
getSignature in class MemberInfopublic String getName()
public void setName(String newName)
public boolean isMethod()
public ConstPool getConstPool()
public boolean isConstructor()
public boolean isStaticInitializer()
public int getAccessFlags()
AccessFlagpublic void setAccessFlags(int acc)
AccessFlagpublic String getDescriptor()
Descriptorpublic void setDescriptor(String desc)
Descriptorpublic void addAttribute(AttributeInfo info)
MemberInfo.getAttributes()public ExceptionsAttribute getExceptionsAttribute()
public CodeAttribute getCodeAttribute()
public void removeExceptionsAttribute()
public void setExceptionsAttribute(ExceptionsAttribute cattr)
The added attribute must share the same constant pool table as this
method_info structure.
public void removeCodeAttribute()
public void setCodeAttribute(CodeAttribute cattr)
The added attribute must share the same constant pool table as this
method_info structure.
public int getLineNumber(int pos)
pos - the position of the bytecode (>= 0). an index into the code
array.public void setSuperclass(String superclass) throws BadBytecode
This method modifies a call to super(), which should be
at the head of a constructor body, so that a constructor in a different
super class is called. This method does not change actual parameters.
Hence the new super class must have a constructor with the same signature
as the original one.
This method should be called when the super class of the class declaring this method is changed.
This method does not perform anything unless this MethodInfo
represents a constructor.
superclass - the new super classBadBytecodeCopyright © December 07, 2012–2015 The Internet Party. All rights reserved.