javassist.expr

Class MethodCall

public class MethodCall extends Expr

Method invocation (caller-side expression).
Method Summary
StringgetClassName()
Returns the class name of the target object, which the method is called on.
StringgetFileName()
Returns the source file containing the method call.
intgetLineNumber()
Returns the line number of the source line containing the method call.
CtMethodgetMethod()
Returns the called method.
StringgetMethodName()
Returns the name of the called method.
StringgetSignature()
Returns the method signature (the parameter types and the return type).
booleanisSuper()
Returns true if the called method is of a superclass of the current class.
CtClass[]mayThrow()
Returns the list of exceptions that the expression may throw.
voidreplace(String statement)
Replaces the method call with the bytecode derived from the given source text.
CtBehaviorwhere()
Returns the method or constructor containing the method-call expression represented by this object.

Method Detail

getClassName

public String getClassName()
Returns the class name of the target object, which the method is called on.

getFileName

public String getFileName()
Returns the source file containing the method call.

Returns: null if this information is not available.

getLineNumber

public int getLineNumber()
Returns the line number of the source line containing the method call.

Returns: -1 if this information is not available.

getMethod

public CtMethod getMethod()
Returns the called method.

getMethodName

public String getMethodName()
Returns the name of the called method.

getSignature

public String getSignature()
Returns the method signature (the parameter types and the return type). The method signature is represented by a character string called method descriptor, which is defined in the JVM specification.

Since: 3.1

See Also: getSignature Descriptor

isSuper

public boolean isSuper()
Returns true if the called method is of a superclass of the current class.

mayThrow

public CtClass[] mayThrow()
Returns the list of exceptions that the expression may throw. This list includes both the exceptions that the try-catch statements including the expression can catch and the exceptions that the throws declaration allows the method to throw.

replace

public void replace(String statement)
Replaces the method call with the bytecode derived from the given source text.

$0 is available even if the called method is static.

Parameters: statement a Java statement.

where

public CtBehavior where()
Returns the method or constructor containing the method-call expression represented by this object.
Javassist, a Java-bytecode translator toolkit.
Copyright (C) 1999-2006 Shigeru Chiba. All Rights Reserved.