Package org.apache.groovy.contracts.generation

# Class OldVariableGenerationUtility

java.lang.Object
org.apache.groovy.contracts.generation.OldVariableGenerationUtility

public class OldVariableGenerationUtility extends Object

Central place where code generation for the `old` closure variable takes place.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `OLD_VARIABLES_METHOD`
  Synthetic helper method name used to compute the `old` variable map for postconditions.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `OldVariableGenerationUtility()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `addOldVariableMethodNode(ClassNode classNode)`
  Creates a synthetic method handling generation of the `old` variable map.

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

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

- ## Field Details

  - ### OLD_VARIABLES_METHOD

    public static final String OLD_VARIABLES_METHOD
    Synthetic helper method name used to compute the `old` variable map for postconditions.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### OldVariableGenerationUtility

    public OldVariableGenerationUtility()

- ## Method Details

  - ### addOldVariableMethodNode

    public static void addOldVariableMethodNode(ClassNode classNode)
    Creates a synthetic method handling generation of the `old` variable map. If a super class declares the same synthetic method it will be called and the results will be merged.
    Parameters:
      `classNode` - which contains postconditions, so an old variable generating method makes sense here.