public class MethodPointerExpression
extends Expression
Represents a method pointer on an object such as
foo.&bar which means find the method pointer for the bar method on the foo instance.
This is equivalent to:
foo.metaClass.getMethodPointer(foo, "bar")
| Modifiers | Name | Description |
|---|---|---|
protected Expression |
expression |
Receiver of the method pointer. |
protected Expression |
methodName |
Expression that names the method, as in the bar of {@code foo. |
| Fields inherited from class | Fields |
|---|---|
class Expression |
EMPTY_ARRAY |
| Constructor and description |
|---|
MethodPointerExpression(Expression expression, Expression methodName)Builds a method pointer and sets its type to a plain Closure reference. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public Expression |
getExpression()Returns the receiver, using VariableExpression.THIS_EXPRESSION when none was stored. |
|
public Expression |
getMethodName()Returns the expression that names the method. |
|
public String |
getText() |
|
public Class |
getTypeClass()Returns the runtime class of a method pointer. |
|
public boolean |
isDynamic()Reports this pointer as statically typed. |
|
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 |
Receiver of the method pointer. null means the enclosing this;
getExpression() substitutes VariableExpression.THIS_EXPRESSION.
Expression that names the method, as in the bar of foo.&bar.
Builds a method pointer and sets its type to a plain Closure reference.
expression - receiver, or null for the enclosing thismethodName - expression that names the methodReturns the receiver, using VariableExpression.THIS_EXPRESSION when none was stored.
this when the stored receiver is nullReturns the expression that names the method.
Reports this pointer as statically typed. This implementation always returns false;
the type is a Closure.
falseCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.