Package spoon.pattern

Class InlinedStatementConfigurator

java.lang.Object
spoon.pattern.InlinedStatementConfigurator

public class InlinedStatementConfigurator extends Object
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 Details

    • InlinedStatementConfigurator

      public InlinedStatementConfigurator(PatternBuilder patternBuilder)
  • Method Details

    • getConflictResolutionMode

      public ConflictResolutionMode getConflictResolutionMode()
      Returns:
      current ConflictResolutionMode
    • setConflictResolutionMode

      public InlinedStatementConfigurator setConflictResolutionMode(ConflictResolutionMode conflictResolutionMode)
      Defines what happens when before explicitly added RootNode has to be replaced by another RootNode
      Parameters:
      conflictResolutionMode - to be applied mode
      Returns:
      this to support fluent API
    • inlineIfOrForeachReferringTo

      public InlinedStatementConfigurator inlineIfOrForeachReferringTo(String variableName)
      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

      public InlinedStatementConfigurator markAsInlined(CtForEach foreach)
      marks CtForEach as inline statement.
      Parameters:
      foreach - to be marked CtForEach element
      Returns:
      this to support fluent API
    • markAsInlined

      public InlinedStatementConfigurator markAsInlined(CtIf ifElement)
      marks CtIf as inline statement.
      Parameters:
      ifElement - to be marked CtIf element
      Returns:
      this to support fluent API
    • isFailOnMissingParameter

      public boolean isFailOnMissingParameter()
    • setFailOnMissingParameter

      public InlinedStatementConfigurator setFailOnMissingParameter(boolean failOnMissingParameter)
      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