| Modifier and Type | Class and Description |
|---|---|
static class |
StatementUtils.Group
Represent a group of statements grouped by a given label.
|
static class |
StatementUtils.Label
This class helps to identify a list of statements.
|
| Constructor and Description |
|---|
StatementUtils() |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<StatementUtils.Group> |
applyToStatementsByLabel(java.util.List<StatementUtils.Group> source,
java.util.Map<java.lang.String,Closure<Statement>> mappings)
If you have a given list of
StatementUtils.Group you can apply a set
of transformations on certain statements within a given
group. |
java.util.List<Statement> |
applyToStatementsByLabelFlatten(java.util.List<StatementUtils.Group> source,
java.util.Map<java.lang.String,Closure<Statement>> mappings)
If you have a given list of
StatementUtils.Group you can apply a set
of transformations on certain statements within a given
group. |
StatementUtils.Label |
extractLabelFrom(Statement stmt)
If you would like to take the text from a label in your code
|
java.util.List<StatementUtils.Group> |
groupStatementsByLabel(BlockStatement blockStmt)
Use this function to group expression statements found within a
given block statement.
|
public java.util.List<StatementUtils.Group> groupStatementsByLabel(BlockStatement blockStmt)
StatementUtils.Group instances.blockStmt - the block statement where the statements we
want to group areStatementUtils.Grouppublic StatementUtils.Label extractLabelFrom(Statement stmt)
check: 'is greater than'
//...
stmt - The statement we would like to take a label fromStatementUtils.Labelpublic java.util.List<Statement> applyToStatementsByLabelFlatten(java.util.List<StatementUtils.Group> source, java.util.Map<java.lang.String,Closure<Statement>> mappings)
StatementUtils.Group you can apply a set
of transformations on certain statements within a given
group. Lets say we have group all statements in a method and we
would like to apply a transformation to statements in the group
identified with 'check':
['check': { Group group, ExpressionStatement stmt -> stmt }]
This particular transformation will do nothing, it only returns the same statement.source - the list of groups we want to operate overmappings - a map. Keys are label names and values are
closures transforming every statement of the identified group.public java.util.List<StatementUtils.Group> applyToStatementsByLabel(java.util.List<StatementUtils.Group> source, java.util.Map<java.lang.String,Closure<Statement>> mappings)
StatementUtils.Group you can apply a set
of transformations on certain statements within a given
group. Lets say we have group all statements in a method and we
would like to apply a transformation to statements in the group
identified with 'check':
['check': { Group group, ExpressionStatement stmt -> stmt }]
This particular transformation will do nothing, it only returns the same statement.source - the list of groups we want to operate overmappings - a map. Keys are label names and values are
closures transforming every statement of the identified group.