javassist.expr

Class Expr

public abstract class Expr extends Object implements Opcode

Expression.
Method Summary
StringgetFileName()
Returns the source file containing the expression.
intgetLineNumber()
Returns the line number of the source line containing the expression.
intindexOfBytecode()
Returns the index of the bytecode corresponding to the expression.
CtClass[]mayThrow()
Returns the list of exceptions that the expression may throw.
abstract voidreplace(String statement)
Replaces this expression with the bytecode derived from the given source text.
voidreplace(String statement, ExprEditor recursive)
Replaces this expression with the bytecode derived from the given source text and ExprEditor.
CtBehaviorwhere()
Returns the constructor or method containing the expression.

Method Detail

getFileName

public String getFileName()
Returns the source file containing the expression.

Returns: null if this information is not available.

getLineNumber

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

Returns: -1 if this information is not available.

indexOfBytecode

public int indexOfBytecode()
Returns the index of the bytecode corresponding to the expression. It is the index into the byte array containing the Java bytecode that implements the method.

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 abstract void replace(String statement)
Replaces this expression with the bytecode derived from the given source text.

Parameters: statement a Java statement.

replace

public void replace(String statement, ExprEditor recursive)
Replaces this expression with the bytecode derived from the given source text and ExprEditor.

Parameters: statement a Java statement. recursive if not null, the substituted bytecode is recursively processed by the given ExprEditor.

Since: 3.1

where

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