Class SchemaFinder
java.lang.Object
io.github.besi97.graphql.codegen.supplier.SchemaFinder
Walks a directory tree to find GraphQL schema files.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSchemaFinder(Path rootDir) Creates a new SchemaFinder with the given directory as root of the search. -
Method Summary
Modifier and TypeMethodDescriptionWalks the directory tree starting at the root provided in the constructor to find GraphQL schemas.voidsetExcludedFiles(Set<String> excludedFiles) Sets a set of paths to exclude from the search even if they match the include pattern.voidsetIncludePattern(String includePattern) Sets the pattern that filenames should match to be included in the result.voidsetRecursive(boolean recursive) Sets whether this finder should recursively search in nested directories.
-
Field Details
-
DEFAULT_INCLUDE_PATTERN
- See Also:
-
DEFAULT_RECURSIVE
public static final boolean DEFAULT_RECURSIVE- See Also:
-
-
Constructor Details
-
SchemaFinder
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
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 thePatternclass- See Also:
-
setExcludedFiles
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
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
-