|
TechTrader Bytecode Toolkit | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.techtrader.modules.tools.bytecode.BCEntity | +--com.techtrader.modules.tools.bytecode.BCMethod
Representation of a bytecode method of a class; a BCMethod can only be obtained from a BCClass. Note that this class has method to manipulate its declared excptions and code for convenience only; they can be manipulated directly through the ATTR_EXCEPTIONS and ATTR_CODE attributes.
Constructor Summary | |
protected |
BCMethod(BCClass owner)
Protected constructor. |
Method Summary | |
void |
acceptVisit(BCVisitor visit)
Accept a visit from a BCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this object. |
Code |
addCode()
Add a code block to this method; replaces the old block if it exists. |
void |
addExceptionType(Class type)
Add an exception to those declared by this method. |
void |
addExceptionTypeName(String name)
Add an exception to those declared by this method. |
void |
addParamType(Class type)
Add a parameter type to this method. |
void |
addParamTypeName(String name)
Add a parameter type to this method. |
void |
clearExceptionTypes()
Remove all declared exceptions from this method. |
int |
getAccessFlags()
Return the access flags for this class as a bit array of ACCESS_XXX constants. |
Code |
getCode()
Get the code for this method; returns null if none. |
int |
getDescriptorIndex()
Get the index in the constant pool of the UTF entry holding the descriptor of this method. |
String[] |
getExceptionTypeNames()
Get the exception types thrown by this method. |
Class[] |
getExceptionTypes()
Get the exception types thrown by this method. |
String |
getName()
Get the name of this method. |
int |
getNameIndex()
Get the index in the constant pool of the UTF entry holding the name of this method. |
BCClass |
getOwner()
Get the BCClass that owns this method. |
String[] |
getParamTypeNames()
Get the names of all the parameter types for this method. |
Class[] |
getParamTypes()
Get the types of parameters this method takes. |
ConstantPool |
getPool()
Get the class constant pool; this method delegates to the owning class. |
Class |
getReturnType()
Get the Class of the return type of this method. |
String |
getReturnTypeName()
Get the name of the class type returned by this method. |
Code |
importCode(Code code)
Import a code block from another method. |
protected void |
invalidate()
Used when this field is deleted from its class. |
boolean |
isAbstract()
Manipulate the method access flags. |
boolean |
isFinal()
Manipulate the method access flags. |
boolean |
isNative()
Manipulate the method access flags. |
boolean |
isPackage()
Manipulate the method access flags. |
boolean |
isPrivate()
Manipulate the method access flags. |
boolean |
isProtected()
Manipulate the method access flags. |
boolean |
isPublic()
Manipulate the method access flags. |
boolean |
isStatic()
Manipulate the method access flags. |
boolean |
isStrict()
Manipulate the method access flags. |
boolean |
isSynchronized()
Manipulate the method access flags. |
void |
makePackage()
Manipulate the method access flags. |
void |
makePrivate()
Manipulate the method access flags. |
void |
makeProtected()
Manipulate the method access flags. |
void |
makePublic()
Manipulate the method access flags. |
protected void |
readData(DataInput in)
|
boolean |
removeCode()
Remove the code from this method; note that this actually removes the Code attribute completely; if you want to make an empty code block use the Code.clear() method. |
boolean |
removeExceptionType(Class type)
Remove the given exception type from those that this method declares in its throws clause. |
boolean |
removeExceptionTypeName(String name)
Remove the given exception type from those that this method declares in its throws clause. |
boolean |
removeParamType(Class type)
Remove a parameter from this method. |
boolean |
removeParamTypeName(String name)
Remove a parameter from this method. |
void |
setAbstract(boolean on)
Manipulate the method access flags. |
void |
setAccessFlags(int access)
Set the access flags for this class as a bit array of ACCESS_XXX constants. |
void |
setDescriptor(Class returnType,
Class[] paramTypes)
Set this method descriptor; using this method is much more efficient than setting the return type and param types separately. |
void |
setDescriptor(String returnType,
String[] paramTypes)
Set this method descriptor; using this method is much more efficient than setting the return type and param types separately. |
void |
setDescriptorIndex(int index)
Set the index in the constant pool of the UTF entry holding the descriptor of this method. |
void |
setExceptionTypeNames(String[] types)
Set the exception types for this method. |
void |
setExceptionTypes(Class[] types)
Set the exception types for this method. |
void |
setFinal(boolean on)
Manipulate the method access flags. |
void |
setName(String name)
Set the name of this method. |
void |
setNameIndex(int index)
Set the index in the constant pool of the UTF entry holding the name of this method. |
void |
setNative(boolean on)
Manipulate the method access flags. |
void |
setParamTypeNames(String[] names)
Set the parameter types of this method. |
void |
setParamTypes(Class[] types)
Set the parameter type of this method. |
void |
setReturnType(Class type)
Set the return type of this method. |
void |
setReturnTypeName(String name)
Set the return type of this method. |
void |
setStatic(boolean on)
Manipulate the method access flags. |
void |
setStrict(boolean on)
Manipulate the method access flags. |
void |
setSynchronized(boolean on)
Manipulate the method access flags. |
protected void |
writeData(DataOutput out)
|
Methods inherited from class com.techtrader.modules.tools.bytecode.BCEntity |
addAttribute,
clearAttributes,
getAttribute,
getAttributes,
getAttributes,
importAttribute,
importAttributes,
readAttributes,
removeAttribute,
removeAttribute,
visitAttributes,
writeAttributes |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
protected BCMethod(BCClass owner)
Method Detail |
protected void invalidate()
public BCClass getOwner()
public int getAccessFlags()
public void setAccessFlags(int access)
public boolean isPublic()
public void makePublic()
public boolean isProtected()
public void makeProtected()
public boolean isPrivate()
public void makePrivate()
public boolean isPackage()
public void makePackage()
public boolean isFinal()
public void setFinal(boolean on)
public boolean isStatic()
public void setStatic(boolean on)
public boolean isSynchronized()
public void setSynchronized(boolean on)
public boolean isNative()
public void setNative(boolean on)
public boolean isAbstract()
public void setAbstract(boolean on)
public boolean isStrict()
public void setStrict(boolean on)
public int getNameIndex()
public void setNameIndex(int index)
public int getDescriptorIndex()
public void setDescriptorIndex(int index)
public String getName()
public void setName(String name)
public String getReturnTypeName()
public Class getReturnType() throws ClassNotFoundException
public String[] getParamTypeNames()
public Class[] getParamTypes() throws ClassNotFoundException
public void setReturnTypeName(String name)
public void setReturnType(Class type)
public void setParamTypeNames(String[] names)
public void setParamTypes(Class[] types)
public void addParamTypeName(String name)
public boolean removeParamTypeName(String name)
public boolean removeParamType(Class type)
public void addParamType(Class type)
public void setDescriptor(String returnType, String[] paramTypes)
public void setDescriptor(Class returnType, Class[] paramTypes)
public String[] getExceptionTypeNames()
public Class[] getExceptionTypes() throws ClassNotFoundException
public void clearExceptionTypes()
public boolean removeExceptionTypeName(String name)
public boolean removeExceptionType(Class type)
public void setExceptionTypeNames(String[] types)
public void setExceptionTypes(Class[] types)
public void addExceptionTypeName(String name)
public void addExceptionType(Class type)
public Code getCode()
public Code addCode()
public boolean removeCode()
public Code importCode(Code code)
public ConstantPool getPool()
protected void readData(DataInput in) throws IOException
protected void writeData(DataOutput out) throws IOException
public void acceptVisit(BCVisitor visit)
|
TechTrader Bytecode Toolkit | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |