Interface ImportLayoutStyle.Block

All Known Implementing Classes:
ImportLayoutStyle.Block.AllOthers, ImportLayoutStyle.Block.BlankLines, ImportLayoutStyle.Block.ImportPackage
Enclosing class:
ImportLayoutStyle

public static interface ImportLayoutStyle.Block
A block represents a grouping of imports based on matching rules. The block provides a mechanism for matching and storing J.Imports that belong to the block.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
     
    static class 
    A specialized block implementation to act as a blank line separator between import groupings.
    static class 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    accept(JRightPadded<org.openrewrite.java.tree.J.Import> anImport)
    This method will determine if the passed in import is a match for the rules defined on the block.
    List<JRightPadded<org.openrewrite.java.tree.J.Import>>
    orderedImports(org.openrewrite.java.style.ImportLayoutStyle.LayoutState layoutState, int classCountToUseStarImport, int nameCountToUseStarImport, org.openrewrite.java.style.ImportLayoutStyle.ImportLayoutConflictDetection importLayoutConflictDetection, List<ImportLayoutStyle.Block> packagesToFold)
     
  • Method Details

    • accept

      boolean accept(JRightPadded<org.openrewrite.java.tree.J.Import> anImport)
      This method will determine if the passed in import is a match for the rules defined on the block. If the import is matched, it will be internally stored in the block.
      Parameters:
      anImport - The import to be compared against the block's matching rules.
      Returns:
      true if the import was a match
    • orderedImports

      List<JRightPadded<org.openrewrite.java.tree.J.Import>> orderedImports(org.openrewrite.java.style.ImportLayoutStyle.LayoutState layoutState, int classCountToUseStarImport, int nameCountToUseStarImport, org.openrewrite.java.style.ImportLayoutStyle.ImportLayoutConflictDetection importLayoutConflictDetection, List<ImportLayoutStyle.Block> packagesToFold)
      Returns:
      Imports belonging to this block, folded appropriately.