Package spoon.pattern

Class InlinedStatementConfigurator


  • public class InlinedStatementConfigurator
    extends java.lang.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 Detail

      • InlinedStatementConfigurator

        public InlinedStatementConfigurator​(PatternBuilder patternBuilder)
    • Method Detail

      • 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​(java.lang.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​(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