Class JavaTemplatePrinter


  • public class JavaTemplatePrinter
    extends JavaPrinter<org.openrewrite.Cursor>
    • Constructor Detail

      • JavaTemplatePrinter

        public JavaTemplatePrinter​(java.lang.String code,
                                   org.openrewrite.Tree changing,
                                   JavaCoordinates coordinates,
                                   java.util.Set<java.lang.String> imports)
    • Method Detail

      • visit

        @Nullable
        public @Nullable J visit​(@Nullable
                                 @Nullable org.openrewrite.Tree tree,
                                 org.openrewrite.Cursor insertionScope)
        Overrides:
        visit in class JavaPrinter<org.openrewrite.Cursor>
      • visitBlock

        public J visitBlock​(J.Block block,
                            org.openrewrite.Cursor insertionScope)
        Overrides:
        visitBlock in class JavaPrinter<org.openrewrite.Cursor>
      • findCoordinateCursor

        public static org.openrewrite.Cursor findCoordinateCursor​(org.openrewrite.Cursor parentScope,
                                                                  org.openrewrite.Tree changing,
                                                                  JavaCoordinates coordinates)
        This method will extends the insertion scope cursor by starting at the parent cursor and then walking into the possibly mutated tree until the coordinates are found.
        Parameters:
        parentScope - The parent scope is root from the original AST
        changing - The possibly mutated tree
        coordinates - The coordinates to search for
        Returns:
        A cursor representing the path from the original compilation unit to the coordinates element in the mutated tree