Interface FileTree<T extends FileResource>
- Type Parameters:
T- the contained type
- All Known Subinterfaces:
ClassTree, DocumentationDirectory, JavadocDirectory, JavaResourceTree
- All Known Implementing Classes:
DefaultClassTree, DefaultFileTree, DefaultJavaResourceTree
The representation of a file tree. A file tree is a collection
of FileResources that are contained in a directory hierarchy
with a common root.
Implementations of this interface must provide a ResourceFactory
that supports the invocation of ResourceFactory.create(ResourceType, Project, Object...) with
arguments
Implementations of this interface must ensure that the content
of the file tree is not evaluated before a consuming operation
is performed on the Stream returned by paths(). The delayed
evaluation includes resolving a relative path for root against
the project's directory.
-
Nested Class Summary
Nested classes/interfaces inherited from interface InputTree
InputTree.Entry<T> -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Deletes all files in this file tree and directories that are empty after deletion of the files including the root directory.clear()Re-scans the file tree for changes.static <T extends FileResource>
FileTree<T> Creates a new file tree with elements of the given type from the given project and path.static FileTree<FileResource> Creates a new general file tree from the given project and path.paths()Returns the paths of the files in this file tree relative to its root.default Pathroot()Returns the root of the file tree searched for files as an absolute path.root(boolean relativize) Returns the root of the file tree containing the files.Includes directories in the file tree if they match the pattern used when creating the file tree, and are not excluded (i.e. don't match the exclude pattern).Methods inherited from interface Resource
asOfLocalized, isNewerThan, name, type
-
Method Details
-
withDirectories
Includes directories in the file tree if they match the pattern used when creating the file tree, and are not excluded (i.e. don't match the exclude pattern).- Returns:
- the file tree
-
root
-
root
-
paths
-
clear
-
cleanup
-
of
Creates a new general file tree from the given project and path.- Parameters:
project- the projectdirectory- the root of the file tree relative to the project's directory (or an absolute path)patterns- the patterns. If no patterns are given, the default pattern "**/*" is used- Returns:
- the file tree
-
of
static <T extends FileResource> FileTree<T> of(Project project, Path directory, Class<T> type, String... patterns) Creates a new file tree with elements of the given type from the given project and path.- Type Parameters:
T- the generic type- Parameters:
project- the projectdirectory- the root of the file tree relative to the project's directory (or an absolute path)type- the typepatterns- the patterns. If no patterns are given, the default pattern "**/*" is used- Returns:
- the file tree
-