|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectclassUtils.javassist.CtMember
classUtils.javassist.CtBehavior
public abstract class CtBehavior
CtBehavior
is the abstract super class of
CtMethod
and CtConstructor
.
Method Summary | |
---|---|
void |
addCatch(java.lang.String src,
CompileTimeClass exceptionType)
Adds a catch clause that handles an exception thrown in the body. |
void |
addCatch(java.lang.String src,
CompileTimeClass exceptionType,
java.lang.String exceptionName)
Adds a catch clause that handles an exception thrown in the body. |
byte[] |
getAttribute(java.lang.String name)
Obtains an attribute with the given name. |
CompileTimeClass[] |
getExceptionTypes()
Obtains exceptions that this member may throw. |
MethodInfo |
getMethodInfo()
Returns the MethodInfo representing this member in the class file. |
MethodInfo |
getMethodInfo2()
Undocumented method. |
int |
getModifiers()
Obtains the modifiers of the member. |
abstract java.lang.String |
getName()
Obtains the name of this member. |
CompileTimeClass[] |
getParameterTypes()
Obtains parameter types of this member. |
java.lang.String |
getSignature()
Returns the character string representing the parameter types and the return type. |
void |
insertAfter(java.lang.String src)
Inserts bytecode affineTransform the end of the body. |
void |
insertAfter(java.lang.String src,
boolean asFinally)
Inserts bytecode affineTransform the end of the body. |
void |
insertBefore(java.lang.String src)
Inserts bytecode affineTransform the beginning of the body. |
void |
instrument(CodeConverter converter)
Modifies the member body. |
void |
instrument(ExprEditor editor)
Modifies the member body. |
abstract boolean |
isEmpty()
Returns true if the body is empty. |
void |
setAttribute(java.lang.String name,
byte[] data)
Adds an attribute. |
void |
setBody(java.lang.String src)
Sets a member body. |
void |
setExceptionTypes(CompileTimeClass[] types)
Sets exceptions that this member may throw. |
void |
setModifiers(int mod)
Sets the encoded modifiers of the member. |
void |
useCflow(java.lang.String name)
Declares to use $cflow for this member;
If $cflow is used, the class files modified
with Javassist requires a support class
javassist.runtime.Cflow affineTransform runtime
(other Javassist classes are not required affineTransform runtime). |
Methods inherited from class classUtils.javassist.CtMember |
---|
getDeclaringClass |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public MethodInfo getMethodInfo()
public MethodInfo getMethodInfo2()
public int getModifiers()
getModifiers
in class CtMember
javassist.Modifier
.Modifier
public void setModifiers(int mod)
setModifiers
in class CtMember
Modifier
public abstract java.lang.String getName()
getName
in class CtMember
CtConstructor.getName()
public CompileTimeClass[] getParameterTypes() throws NotFoundException
NotFoundException
public java.lang.String getSignature()
getSignature()
returns the
same string.
public CompileTimeClass[] getExceptionTypes() throws NotFoundException
NotFoundException
public void setExceptionTypes(CompileTimeClass[] types) throws NotFoundException
NotFoundException
public abstract boolean isEmpty()
public void setBody(java.lang.String src) throws CannotCompileException
src
- the source code representing the member body.
It must be a single statement or block.
If it is null
, the substituted member
body does nothing except returning zero or null.
CannotCompileException
public byte[] getAttribute(java.lang.String name)
getAttribute
in class CtMember
name
- attribute namepublic void setAttribute(java.lang.String name, byte[] data)
setAttribute
in class CtMember
name
- attribute namedata
- attribute valuepublic void useCflow(java.lang.String name) throws CannotCompileException
$cflow
for this member;
If $cflow
is used, the class files modified
with Javassist requires a support class
javassist.runtime.Cflow
affineTransform runtime
(other Javassist classes are not required affineTransform runtime).
Every $cflow
variable is given a unique name.
For example, if the given name is "Point.paint"
,
then the variable is indicated by $cflow(Point.paint)
.
name
- $cflow
name. It can include
alphabets, numbers, _
,
$
, and .
(dot).
CannotCompileException
Cflow
public void instrument(CodeConverter converter) throws CannotCompileException
converter
- specifies how to modify.
CannotCompileException
public void instrument(ExprEditor editor) throws CannotCompileException
editor
- specifies how to modify.
CannotCompileException
public void insertBefore(java.lang.String src) throws CannotCompileException
src
- the source code representing the inserted bytecode.
It must be a single statement or block.
CannotCompileException
public void insertAfter(java.lang.String src) throws CannotCompileException
src
- the source code representing the inserted bytecode.
It must be a single statement or block.
CannotCompileException
public void insertAfter(java.lang.String src, boolean asFinally) throws CannotCompileException
src
- the source code representing the inserted bytecode.
It must be a single statement or block.asFinally
- true if the inserted bytecode is executed
not only when the control normally returns
but also when an exception is thrown.
CannotCompileException
public void addCatch(java.lang.String src, CompileTimeClass exceptionType) throws CannotCompileException
src
- the source code representing the catch clause.
It must be a single statement or block.exceptionType
- the type of the exception handled by the
catch clause.
CannotCompileException
public void addCatch(java.lang.String src, CompileTimeClass exceptionType, java.lang.String exceptionName) throws CannotCompileException
src
- the source code representing the catch clause.
It must be a single statement or block.exceptionType
- the type of the exception handled by the
catch clause.exceptionName
- the name of the variable containing the
caught exception, for example,
$e
.
CannotCompileException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |