javassist.expr

Class Cast

public class Cast extends Expr

Explicit type cast.
Method Summary
StringgetFileName()
Returns the source file containing the type-cast expression.
intgetLineNumber()
Returns the line number of the source line containing the type-cast expression.
CtClassgetType()
Returns the CtClass object representing the type specified by the cast.
CtClass[]mayThrow()
Returns the list of exceptions that the expression may throw.
voidreplace(String statement)
Replaces the explicit cast operator with the bytecode derived from the given source text.
CtBehaviorwhere()
Returns the method or constructor containing the type cast expression represented by this object.

Method Detail

getFileName

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

Returns: null if this information is not available.

getLineNumber

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

Returns: -1 if this information is not available.

getType

public CtClass getType()
Returns the CtClass object representing the type specified by the cast.

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 explicit cast operator with the bytecode derived from the given source text.

$0 is available but the value is null.

Parameters: statement a Java statement.

where

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