[Groovy] Class VariableAccessReplacer

  • org.codehaus.groovy.transform.tailrec.VariableAccessReplacer

Replace all access to variables and args by new variables. The variable names to replace as well as their replacement name and type have to be configured in nameAndTypeMapping before calling replaceIn(). The VariableReplacedListener can be set if clients want to react to variable replacement.

Authors:
Johannes Link

Properties Summary

Properties
Type Name and description
VariableReplacedListener listener
Map<String, Map> nameAndTypeMapping
Nested map of variable accesses to replace e.g.: [ 'varToReplace': [name: 'newVar', type: TypeOfVar], 'varToReplace2': [name: 'newVar2', type: TypeOfVar2], ]

Methods Summary

Methods
Type Params Return Type Name and description
void replaceIn(ASTNode root)

Inherited Methods Summary

Inherited Methods
Methods inherited from class Name
class Object wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Property Detail

VariableReplacedListener listener

Map<String, Map> nameAndTypeMapping

Nested map of variable accesses to replace e.g.: [ 'varToReplace': [name: 'newVar', type: TypeOfVar], 'varToReplace2': [name: 'newVar2', type: TypeOfVar2], ]

Method Detail

void replaceIn(ASTNode root)

© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/2.4.21/html/gapi/org/codehaus/groovy/transform/tailrec/VariableAccessReplacer.html