Class SchemaFinder

java.lang.Object
io.github.besi97.graphql.codegen.supplier.SchemaFinder

public class SchemaFinder extends Object
Walks a directory tree to find GraphQL schema files.
  • Field Details

  • Constructor Details

    • SchemaFinder

      public SchemaFinder(Path rootDir)
      Creates a new SchemaFinder with the given directory as root of the search.
      Parameters:
      rootDir - the starting directory of the search. Must not be null.
  • Method Details

    • setRecursive

      public void setRecursive(boolean recursive)
      Sets whether this finder should recursively search in nested directories.
      Parameters:
      recursive - whether the file search should be recursive
    • setIncludePattern

      public void setIncludePattern(String includePattern)
      Sets the pattern that filenames should match to be included in the result. Matching files are only included if they're not part of the excluded files.
      Parameters:
      includePattern - a regular expression pattern as defined by the Pattern class
      See Also:
    • setExcludedFiles

      public void setExcludedFiles(Set<String> excludedFiles)
      Sets a set of paths to exclude from the search even if they match the include pattern. The provided paths are either absolute or relative to the root directory provided in the constructor.
      Parameters:
      excludedFiles - a set of exact file paths to exclude from the search
      See Also:
    • findSchemas

      public List<String> findSchemas() throws IOException
      Walks the directory tree starting at the root provided in the constructor to find GraphQL schemas.
      Returns:
      an alphabetically-sorted list of file paths matching the current configuration
      Throws:
      IOException - if any I/O error occurs while reading the file system