Interface FileTree<T extends FileResource>
- Type Parameters:
T- the contained type
- All Known Subinterfaces:
ClassTree, 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 terminal operation
is performed on the Stream returned by entries(). The delayed
evaluation includes resolving a relative path for root against
the project's directory.
-
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.entries()Returns the paths of the files in this file tree relative to its root.Add a ant-style path pattern to exclude from the tree.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.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
-
exclude
-
root
-
root
-
entries
-
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- 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- Returns:
- the file tree
-