public class MethodInfo extends Object
| 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.
|
AttributeInfo |
getAttribute(String name)
Returns the attribute with the specified name.
|
List<AttributeInfo> |
getAttributes()
Returns all the attributes.
|
ConstPool |
getConstPool()
Returns a constant pool table used by this method.
|
String |
getDescriptor()
Returns a method descriptor.
|
String |
getName()
Returns a method name.
|
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 |
setAccessFlags(int acc)
Sets access flags.
|
void |
setDescriptor(String desc)
Sets a method descriptor.
|
void |
setName(String newName)
Sets a method name.
|
String |
toString()
Returns a string representation of the object.
|
public 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)
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.Descriptorpublic String toString()
public 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 List<AttributeInfo> getAttributes()
List object
is shared with this object. If you add a new attribute to the list,
the attribute is also added to the method represented by this
object. If you remove an attribute from the list, it is also removed
from the method.AttributeInfo objects.AttributeInfopublic AttributeInfo getAttribute(String name)
name - attribute nameAttributeInfo object or null.getAttributes()public void addAttribute(AttributeInfo info)
getAttributes()Copyright © 2012-2013 The Internet Party. All Rights Reserved.