Interface PathRoot

All Known Subinterfaces:
ManagedDirectory

public interface PathRoot
A path-like object that can provide a Java NIO Path.

This enables wrapping various implementations and providers of Path objects in a translucent façade that enables representing paths in a hierarchical format.

Since:
0.0.1
Author:
Ashley Scopes
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Convert the given path root into a JAR and return the byte contents of the JAR.
    boolean
    Determine if two path roots are equivalent.
    Get the parent path root, if there is one.
    Get the Java NIO Path for this path-like object.
    Get a URI representation of this path-like object.
    Get a URL representation of this path-like object.
    int
    Determine the hash-code for the object.
  • Method Details

    • asJar

      byte[] asJar()
      Convert the given path root into a JAR and return the byte contents of the JAR.

      You can use this to create JAR files from existing path roots, if you want to package some compiled outputs into a JAR to use them as inputs to another build.

      Returns:
      the byte contents of the JAR.
      Throws:
      UncheckedIOException - if the JAR cannot be created.
      UnsupportedOperationException - if the operation is not supported.
      Since:
      0.4.0
    • equals

      boolean equals(@Nullable Object other)
      Determine if two path roots are equivalent. If the provided object is null or not an instance of a PathRoot, then this will return false unless otherwise specified.
      Overrides:
      equals in class Object
      Parameters:
      other - the object to compare with.
      Returns:
      true if semantically equal, or false otherwise.
    • hashCode

      int hashCode()
      Determine the hash-code for the object.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code.
    • getPath

      Get the Java NIO Path for this path-like object.
      Returns:
      the path.
      See Also:
    • getUri

      Get a URI representation of this path-like object.
      Returns:
      the URI.
      See Also:
    • getUrl

      Get a URL representation of this path-like object.
      Returns:
      the URL.
      See Also:
    • getParent

      Get the parent path root, if there is one.
      Returns:
      the parent path root, or null if no parent root exists.