|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectclassUtils.javassist.bytecode.MethodInfo
public final class MethodInfo
method_info
structure.
CtMethod.getMethodInfo()
,
CtConstructor.getMethodInfo()
Field Summary | |
---|---|
static java.lang.String |
nameClinit
The name of class initializer (static initializer): <clinit> . |
static java.lang.String |
nameInit
The name of constructors: <init> . |
Constructor Summary | |
---|---|
MethodInfo(ConstPool cp,
java.lang.String methodname,
MethodInfo src,
java.util.Map classnameMap)
Constructs a copy of method_info structure. |
|
MethodInfo(ConstPool cp,
java.lang.String methodname,
java.lang.String desc)
Constructs a method_info structure. |
Method Summary | |
---|---|
void |
addAttribute(AttributeInfo info)
Appends an attribute. |
int |
getAccessFlags()
Returns access flags. |
AttributeInfo |
getAttribute(java.lang.String name)
Returns the attribute with the specified name. |
java.util.List |
getAttributes()
Returns all the attributes. |
CodeAttribute |
getCodeAttribute()
Returns a Code attribute. |
ConstPool |
getConstPool()
Returns a constant pool table used by this method. |
java.lang.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. |
java.lang.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 |
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(java.lang.String desc)
Sets a method descriptor. |
void |
setExceptionsAttribute(ExceptionsAttribute cattr)
Adds an Exception attribute. |
void |
setName(java.lang.String newName)
Sets a method name. |
void |
setSuperclass(java.lang.String superclass)
Changes a super constructor called by this constructor. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String nameInit
<init>
.
public static final java.lang.String nameClinit
<clinit>
.
Constructor Detail |
---|
public MethodInfo(ConstPool cp, java.lang.String methodname, java.lang.String desc)
method_info
structure.
cp
- a constant pool tablemethodname
- method namedesc
- method descriptorDescriptor
public MethodInfo(ConstPool cp, java.lang.String methodname, MethodInfo src, java.util.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_info
classnameMap
- specifies pairs of replaced and substituted
name.
BadBytecode
Descriptor
Method Detail |
---|
public java.lang.String getName()
public void setName(java.lang.String newName)
public boolean isMethod()
public ConstPool getConstPool()
public boolean isConstructor()
public boolean isStaticInitializer()
public int getAccessFlags()
AccessFlag
public void setAccessFlags(int acc)
AccessFlag
public java.lang.String getDescriptor()
Descriptor
public void setDescriptor(java.lang.String desc)
Descriptor
public java.util.List getAttributes()
AttributeInfo
objects.AttributeInfo
public AttributeInfo getAttribute(java.lang.String name)
name
- attribute name
AttributeInfo
object or null.public void addAttribute(AttributeInfo info)
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(java.lang.String superclass) throws BadBytecode
This method modifies a call to super()
,
which should be affineTransform the
head of a constructor body, so that a constructor in a different
super class is called. This method does not change actural
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 class
BadBytecode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |