Class MultiRootPathTree

java.lang.Object
io.quarkus.paths.MultiRootPathTree
All Implemented Interfaces:
OpenPathTree, PathTree, Closeable, AutoCloseable

public class MultiRootPathTree extends Object implements OpenPathTree
  • Constructor Details

    • MultiRootPathTree

      public MultiRootPathTree(PathTree... trees)
  • Method Details

    • isArchiveOrigin

      public boolean isArchiveOrigin()
      If at least one of the PathTrees is not an archive, we return false.
      Specified by:
      isArchiveOrigin in interface PathTree
    • getRoots

      public Collection<Path> getRoots()
      Description copied from interface: PathTree
      The roots of the path tree.

      Note that you shouldn't use these roots for browsing except if the PathTree is open.

      Specified by:
      getRoots in interface PathTree
      Returns:
      roots of the path tree
    • getManifestAttributes

      public ManifestAttributes getManifestAttributes()
      Description copied from interface: PathTree
      If META-INF/MANIFEST.MF found, reads it and returns an instance of ManifestAttributes, a trimmed down version of the Manifest, otherwise returns null.
      Specified by:
      getManifestAttributes in interface PathTree
      Returns:
      parsed META-INF/MANIFEST.MF if it's found, otherwise null
    • walk

      public void walk(PathVisitor visitor)
      Description copied from interface: PathTree
      Walks the tree.
      Specified by:
      walk in interface PathTree
      Parameters:
      visitor - path visitor
    • walkIfContains

      public void walkIfContains(String relativePath, PathVisitor visitor)
      Description copied from interface: PathTree
      Walks a subtree of this tree that begins with a passed in relativePath, if the tree contains relativePath. If the tree does not contain relativePath then the method returns without an error.

      This method does not create a new PathTree with the root at relativePath. It simply applies an inclusion filter to this PathTree instance, keeping the same root.

      Specified by:
      walkIfContains in interface PathTree
      Parameters:
      relativePath - relative path from which the walk should begin
      visitor - path visitor
    • apply

      public <T> T apply(String relativePath, Function<PathVisit,T> func)
      Description copied from interface: PathTree
      Applies a function to a given path relative to the root of the tree. If the path isn't found in the tree, the PathVisit argument passed to the function will be null.
      Specified by:
      apply in interface PathTree
      Type Parameters:
      T - resulting type
      Parameters:
      relativePath - relative path to process
      func - processing function
      Returns:
      result of the function
    • accept

      public void accept(String relativePath, Consumer<PathVisit> func)
      Description copied from interface: PathTree
      Consumes a given path relative to the root of the tree. If the path isn't found in the tree, the PathVisit argument passed to the consumer will be null.
      Specified by:
      accept in interface PathTree
      Parameters:
      relativePath - relative path to consume
      func - path consumer
    • acceptAll

      public void acceptAll(String relativePath, Consumer<PathVisit> func)
      Description copied from interface: PathTree
      Consumes a given path relative to the root of the tree. If the path isn't found in the tree, the PathVisit argument passed to the consumer will be null. If multiple items match then the consumer will be called multiple times.
      Specified by:
      acceptAll in interface PathTree
      Parameters:
      relativePath - relative path to consume
      func - path consumer
    • contains

      public boolean contains(String relativePath)
      Description copied from interface: PathTree
      Checks whether the tree contains a relative path.
      Specified by:
      contains in interface PathTree
      Parameters:
      relativePath - path relative to the root of the tree
      Returns:
      true, in case the tree contains the path, otherwise - false
    • getPath

      public Path getPath(String relativePath)
      Specified by:
      getPath in interface OpenPathTree
    • open

      public OpenPathTree open()
      Description copied from interface: PathTree
      Returns an OpenPathTree for this tree, which is supposed to be closed at the end of processing. It is meant to be an optimization when processing multiple paths of path trees that represent archives. If a path tree does not represent an archive but a directory, for example, this method is expected to be a no-op, returning the original tree as an instance of OpenPathTree.
      Specified by:
      open in interface PathTree
      Returns:
      an instance of OpenPathTree for this path tree
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface OpenPathTree
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • getOriginalTree

      public PathTree getOriginalTree()
      Specified by:
      getOriginalTree in interface OpenPathTree
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object