public class ConstructorCallExpression
extends Expression
implements MethodCall
Represents a constructor call expression.
This includes regular object construction (e.g., new MyClass(args)),
as well as special constructor calls like this() and super() calls within constructors.
The constructor is identified by the type being constructed, and the arguments are wrapped in a TupleExpression.
May optionally use an anonymous inner class.
this() constructor callssuper() constructor calls| Fields inherited from class | Fields |
|---|---|
class Expression |
EMPTY_ARRAY |
| Constructor and description |
|---|
ConstructorCallExpression(ClassNode type, Expression arguments)Creates a constructor call expression. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public Expression |
getArguments()Returns the constructor arguments. |
|
public String |
getMethodAsString() |
|
public ASTNode |
getReceiver() |
|
public String |
getText() |
|
public boolean |
isSpecialCall()Indicates whether this is a special constructor call ( this() or super()). |
|
public boolean |
isSuperCall()Indicates whether this is a super() constructor call. |
|
public boolean |
isThisCall()Indicates whether this is a this() constructor call. |
|
public boolean |
isUsingAnonymousInnerClass()Indicates whether this constructor call uses an anonymous inner class. |
|
public void |
setUsingAnonymousInnerClass(boolean usage)Sets whether this constructor call uses an anonymous inner class. |
|
public String |
toString() |
|
public Expression |
transformExpression(ExpressionTransformer transformer) |
|
public void |
visit(GroovyCodeVisitor visitor) |
| Methods inherited from class | Name |
|---|---|
class Expression |
getType, setType, transformExpression, transformExpressions, transformExpressions |
class AnnotatedNode |
addAnnotation, addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic |
class ASTNode |
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit |
Creates a constructor call expression. Arguments are automatically wrapped in a TupleExpression if not already.
type - the type being constructed (non-null), or ClassNode.THIS/ClassNode.SUPER for special callsarguments - the constructor arguments (may be a single expression or already a TupleExpression)Returns the constructor arguments.
Indicates whether this is a special constructor call (this() or super()).
this() or super() call, false for regular constructor calls Indicates whether this is a super() constructor call.
Indicates whether this is a this() constructor call.
Indicates whether this constructor call uses an anonymous inner class.
Sets whether this constructor call uses an anonymous inner class.
usage - true if an anonymous inner class is being used, false otherwiseCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.