public class PostfixExpression
extends Expression
Represents a postfix unary expression like i++ or value--.
The operation is applied after the value is used, returning the original value before modification.
Examples:
counter++ - return counter then increment it
index-- - return index then decrement it
| Fields inherited from class | Fields |
|---|---|
class Expression |
EMPTY_ARRAY |
| Constructor and description |
|---|
PostfixExpression(Expression expression, Token operation)Creates a postfix expression. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public Expression |
getExpression()Returns the expression being modified by the postfix operation. |
|
public Token |
getOperation()Returns the operator token. |
|
public String |
getText()Returns a string representation of this postfix expression. |
|
public ClassNode |
getType()Returns the type of this postfix expression, which is the type of the operand. |
|
public void |
setExpression(Expression expression)Sets the expression to apply the postfix operation to. |
|
public String |
toString()Returns a debug string representation. |
|
public Expression |
transformExpression(ExpressionTransformer transformer)Transforms this expression by applying the given transformer to the inner expression, creating a new postfix expression with the transformed operand. |
|
public void |
visit(GroovyCodeVisitor visitor)Accepts a GroovyCodeVisitor using the visitor pattern. |
| 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 postfix expression.
expression - the expression to apply the operation tooperation - the operator token (++ or --)Returns the expression being modified by the postfix operation.
Returns the operator token.
++ or -- tokenReturns a string representation of this postfix expression.
Returns the type of this postfix expression, which is the type of the operand.
Sets the expression to apply the postfix operation to.
expression - the expression, typically a variable or propertyReturns a debug string representation.
Transforms this expression by applying the given transformer to the inner expression, creating a new postfix expression with the transformed operand.
transformer - the ExpressionTransformer to applyAccepts a GroovyCodeVisitor using the visitor pattern.
visitor - the visitor to acceptCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.