Interface FileTree<T extends FileResource>

Type Parameters:
T - the contained type
All Superinterfaces:
Resource, Resources<T>
All Known Subinterfaces:
ClassTree
All Known Implementing Classes:
DefaultClassTree, DefaultFileTree, JavaResourceTree

public interface FileTree<T extends FileResource> extends Resources<T>

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

  • Project the project
  • Path the root directory
  • String the pattern
  • boolean whether to include directories (optional, defaults to false)

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 Type
    Method
    Description
    Re-scans the file tree for changes.
    Deletes all files in this file tree and directories that are empty after deletion of the files (expect for root, which is not deleted).
    Returns the paths of the files in this file tree relative to its root.
    exclude(String pattern)
    Add a file name pattern to exclude from the tree.
    default Path
    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.

    Methods inherited from interface Resource

    asOfLocalized, type

    Methods inherited from interface Resources

    add, addAll, addAll, asOf, isEmpty, stream
  • Method Details

    • withDirectories

      Includes directories in the file tree.
      Returns:
      the file tree
    • exclude

      FileTree<T> exclude(String pattern)
      Add a file name pattern to exclude from the tree.
      Parameters:
      pattern - the pattern
      Returns:
      the file tree
    • root

      Path root(boolean relativize)
      Returns the root of the file tree containing the files.
      Parameters:
      relativize - whether to return a path relative to the project's directory
      Returns:
      the path
    • root

      default Path root()
      Returns the root of the file tree searched for files as an absolute path.
      Returns:
      the path
    • entries

      Returns the paths of the files in this file tree relative to its root.
      Returns:
      the stream
    • clear

      Re-scans the file tree for changes.
      Specified by:
      clear in interface Resources<T extends FileResource>
      Returns:
      the file tree
    • delete

      Deletes all files in this file tree and directories that are empty after deletion of the files (expect for root, which is not deleted).
      Returns:
      the file tree