javassist.expr

Class NewExpr

public class NewExpr extends Expr

Object creation (new expression).
Method Summary
StringgetClassName()
Returns the class name of the created object.
CtConstructorgetConstructor()
Returns the constructor called for creating the object.
StringgetFileName()
Returns the source file containing the new expression.
intgetLineNumber()
Returns the line number of the source line containing the new expression.
StringgetSignature()
Get the signature of the constructor The signature is represented by a character string called method descriptor, which is defined in the JVM specification.
CtClass[]mayThrow()
Returns the list of exceptions that the expression may throw.
voidreplace(String statement)
Replaces the new expression with the bytecode derived from the given source text.
CtBehaviorwhere()
Returns the method or constructor containing the new expression represented by this object.

Method Detail

getClassName

public String getClassName()
Returns the class name of the created object.

getConstructor

public CtConstructor getConstructor()
Returns the constructor called for creating the object.

getFileName

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

Returns: null if this information is not available.

getLineNumber

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

Returns: -1 if this information is not available.

getSignature

public String getSignature()
Get the signature of the constructor The signature is represented by a character string called method descriptor, which is defined in the JVM specification.

Returns: the signature

See Also: getSignature Descriptor

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 new expression 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 new expression represented by this object.
Javassist, a Java-bytecode translator toolkit.
Copyright (C) 1999-2006 Shigeru Chiba. All Rights Reserved.