Class DefaultFileTree<T extends FileResource>
java.lang.Object
org.jdrupes.builder.core.ResourceObject
org.jdrupes.builder.core.DefaultResources<T>
org.jdrupes.builder.core.DefaultFileTree<T>
- Type Parameters:
T- the type of theFileResources in the tree.
- Direct Known Subclasses:
DefaultClassTree, JavaResourceTree
public class DefaultFileTree<T extends FileResource>
extends DefaultResources<T>
implements FileTree<T>
The default implementation of a
FileTree.-
Field Summary
Fields inherited from class DefaultResources
log -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefaultFileTree(ResourceType<?> type, Project project, Path root, String pattern) Returns a new file tree. -
Method Summary
Modifier and TypeMethodDescriptionasOf()The instant at which this resource was created or last modified.clear()Clears the contained resources.static <T extends FileTree<?>>
TcreateFileTree(ResourceType<T> type, Project project, Path root, String pattern) Creates the a newFileTree.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).entries()Returns the paths of the files in this file tree relative to its root.booleanAdd a file name pattern to exclude from the tree.inthashCode()root()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.stream()Retrieves the resources as a stream.toString()Includes directories in the file tree.Methods inherited from class DefaultResources
add, isEmptyMethods inherited from class ResourceObject
typeMethods inherited from interface Resource
asOfLocalized, type
-
Constructor Details
-
DefaultFileTree
Returns a new file tree. The file tree includes all files matching
patternin the tree starting atroot.rootmay be specified as absolute path or as path relative to theproject's directory (seeProject.directory()).if
projectisnull, androotis a relative path,rootis resolved against the current working directory.pattern- Parameters:
type- the resource typeproject- the projectroot- the rootpattern- the pattern
-
-
Method Details
-
createFileTree
public static <T extends FileTree<?>> T createFileTree(ResourceType<T> type, Project project, Path root, String pattern) Creates the a newFileTree.- Type Parameters:
T- the tree's type- Parameters:
type- the typeproject- the projectroot- the rootpattern- the pattern- Returns:
- the file tree
-
withDirectories
Description copied from interface:FileTreeIncludes directories in the file tree.- Specified by:
withDirectoriesin interfaceFileTree<T extends FileResource>- Returns:
- the file tree
-
exclude
-
root
Description copied from interface:FileTreeReturns the root of the file tree containing the files.- Specified by:
rootin interfaceFileTree<T extends FileResource>- Parameters:
relativize- whether to return a path relative to the project's directory- Returns:
- the path
-
root
-
asOf
-
stream
Description copied from interface:ResourcesRetrieves the resources as a stream.- Specified by:
streamin interfaceResources<T extends FileResource>- Overrides:
streamin classDefaultResources<T extends FileResource>- Returns:
- the stream
-
clear
Description copied from interface:ResourcesClears the contained resources.- Specified by:
clearin interfaceFileTree<T extends FileResource>- Specified by:
clearin interfaceResources<T extends FileResource>- Overrides:
clearin classDefaultResources<T extends FileResource>- Returns:
- the resources
-
delete
-
entries
-
hashCode
- Overrides:
hashCodein classDefaultResources<T extends FileResource>
-
equals
- Overrides:
equalsin classDefaultResources<T extends FileResource>
-
toString
- Overrides:
toStringin classDefaultResources<T extends FileResource>
-