Class Sources

java.lang.Object
com.vaadin.swingbridge.migration.tool.Sources

public final class Sources extends Object
The source-tree walk the tools run: every file under a root matching a glob, build output pruned.
Sources.under(Path.of("src/main/java"), "*.java");
Sources.under(Path.of("src/main/resources"), "*.{html,htm}");

The glob matches the file name, not the path, so *.java means what a migrator reading the invocation expects it to mean.

Lives in com.vaadin.swingbridge.migration.tool rather than in any tool's package because more than one tool uses it — that is the whole membership rule for this package. A class only one tool uses belongs in that tool's package, however generic it looks: Lexed, a Java-source lexer, sits in importswap for exactly that reason.

public only so the tool subpackages can reach it; jar-internal like everything else here, and not part of any surface a migrator calls.

  • Method Details

    • under

      public static List<Path> under(Path root, String glob) throws IOException
      Parameters:
      root - a directory to walk, or a single file to take as-is
      glob - matched against each file name, in FileSystems.getDefault() glob syntax
      Returns:
      the matching files, sorted; empty when the root does not exist
      Throws:
      IOException
    • missing

      public static List<Path> missing(List<Path> roots)
      The roots that name nothing — neither a file nor a directory — in argument order. under(Path, String) reads such a root as empty, which is right for an app that genuinely has no src/main/resources; this is how a tool tells that apart from a typo and says so.