Package org.codehaus.groovy.ast.expr

# Class PostfixExpression

java.lang.Object
org.codehaus.groovy.ast.ASTNode
org.codehaus.groovy.ast.AnnotatedNode
org.codehaus.groovy.ast.expr.Expression
org.codehaus.groovy.ast.expr.PostfixExpression

All Implemented Interfaces:
  `GroovydocHolder<AnnotatedNode>`, `NodeMetaDataHandler`

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

See Also:
  - `for pre-increment/pre-decrement operators`
  - `UnaryMinusExpression`
  - `UnaryPlusExpression`

- ## Field Summary

  ### Fields inherited from class org.codehaus.groovy.ast.expr.Expression

  `EMPTY_ARRAY`

  ### Fields inherited from interface groovy.lang.groovydoc.GroovydocHolder

  `DOC_COMMENT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PostfixExpression(Expression expression, Token operation)`
  Creates a postfix expression.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Expression`
  `getExpression()`
  Returns the expression being modified by the postfix operation.
  `Token`
  `getOperation()`
  Returns the operator token.
  `String`
  `getText()`
  Returns a string representation of this postfix expression.
  `ClassNode`
  `getType()`
  Returns the type of this postfix expression, which is the type of the operand.
  `void`
  `setExpression(Expression expression)`
  Sets the expression to apply the postfix operation to.
  `String`
  `toString()`
  Returns a debug string representation.
  `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.
  `void`
  `visit(GroovyCodeVisitor visitor)`
  Accepts a `GroovyCodeVisitor` using the visitor pattern.

  ### Methods inherited from class org.codehaus.groovy.ast.expr.Expression

  `setType, transformExpressions, transformExpressions`

  ### Methods inherited from class org.codehaus.groovy.ast.AnnotatedNode

  `addAnnotation, addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic`

  ### Methods inherited from class org.codehaus.groovy.ast.ASTNode

  `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler

  `copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, newMetaDataMap, putNodeMetaData, removeNodeMetaData, setNodeMetaData`

- ## Constructor Details

  - ### PostfixExpression

    public PostfixExpression(Expression expression, Token operation)
    Creates a postfix expression.
    Parameters:
      `expression` - the expression to apply the operation to
      `operation` - the operator token (`++` or `--`)

- ## Method Details

  - ### setExpression

    public void setExpression(Expression expression)
    Sets the expression to apply the postfix operation to.
    Parameters:
      `expression` - the expression, typically a variable or property

  - ### getExpression

    public Expression getExpression()
    Returns the expression being modified by the postfix operation.
    Returns:
      the expression

  - ### getOperation

    public Token getOperation()
    Returns the operator token.
    Returns:
      the `++` or `--` token

  - ### getText

    public String getText()
    Returns a string representation of this postfix expression.
    Overrides:
      `getText` in class `ASTNode`
    Returns:
      the text representation, e.g., "(foo++)"

  - ### getType

    public ClassNode getType()
    Returns the type of this postfix expression, which is the type of the operand.
    Overrides:
      `getType` in class `Expression`
    Returns:
      the type of the inner expression

  - ### toString

    public String toString()
    Returns a debug string representation.
    Overrides:
      `toString` in class `Object`
    Returns:
      a string like "PostfixExpression[foo++]"

  - ### transformExpression

    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.
    Specified by:
      `transformExpression` in class `Expression`
    Parameters:
      `transformer` - the `ExpressionTransformer` to apply
    Returns:
      a new postfix expression with transformed inner expression

  - ### visit

    public void visit(GroovyCodeVisitor visitor)
    Accepts a `GroovyCodeVisitor` using the visitor pattern.
    Overrides:
      `visit` in class `ASTNode`
    Parameters:
      `visitor` - the visitor to accept