Package spoon.pattern
Class InlinedStatementConfigurator
java.lang.Object
spoon.pattern.InlinedStatementConfigurator
Builds inline statements of Pattern
For example if the `for` statement in this pattern model
for(Object x : $iterable$) {
System.out.println(x);
}
is configured as inline statement and a Pattern is substituted
using parameter $iterable$ = new String[]{"A", "B", "C"}
then pattern generated this code
System.out.println("A");
System.out.println("B");
System.out.println("C");
because inline statements are executed during substitution process and are not included in generated result.
Main documentation at http://spoon.gforge.inria.fr/pattern.html.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioninlineIfOrForeachReferringTo(String variableName)
marks all CtIf and CtForEach whose expression contains a variable reference named `variableName` as inline statement.boolean
markAsInlined(CtForEach foreach)
marksCtForEach
as inline statement.markAsInlined(CtIf ifElement)
marksCtIf
as inline statement.setConflictResolutionMode(ConflictResolutionMode conflictResolutionMode)
setFailOnMissingParameter(boolean failOnMissingParameter)
-
Constructor Details
-
InlinedStatementConfigurator
-
-
Method Details
-
getConflictResolutionMode
- Returns:
- current
ConflictResolutionMode
-
setConflictResolutionMode
public InlinedStatementConfigurator setConflictResolutionMode(ConflictResolutionMode conflictResolutionMode)- Parameters:
conflictResolutionMode
- to be applied mode- Returns:
- this to support fluent API
-
inlineIfOrForeachReferringTo
marks all CtIf and CtForEach whose expression contains a variable reference named `variableName` as inline statement.- Parameters:
variableName
- to be searched variable name- Returns:
- this to support fluent API
-
markAsInlined
marksCtForEach
as inline statement.- Parameters:
foreach
- to be markedCtForEach
element- Returns:
- this to support fluent API
-
markAsInlined
marksCtIf
as inline statement.- Parameters:
ifElement
- to be markedCtIf
element- Returns:
- this to support fluent API
-
isFailOnMissingParameter
public boolean isFailOnMissingParameter() -
setFailOnMissingParameter
- Parameters:
failOnMissingParameter
- set true if it should fail when some statement cannot be handled as inline set false if ssuch statement should be kept as part of template.- Returns:
- this to support fluent API
-