Interface PathType

All Known Implementing Classes:
JavaPathType, JavaPathType.Modular

@Experimental public interface PathType
The option of a command-line tool where to place the paths to some dependencies. A PathType can identify the Java class-path, the Java module-path, or another kind of path for another programming language for example. Path types are often exclusive. For example, a dependency should not be both on the Java class-path and on the Java module-path.
Since:
4.0.0
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final PathType
    The type for all paths that could not be placed in any of the types requested by a caller.
  • Method Summary

    Modifier and Type
    Method
    Description
    id()
    Returns the unique name of this path type, including the module to patch if any.
    Returns the name of this path type.
    Returns the name of the tool option for this path.
    option(Iterable<? extends Path> paths)
    Returns the option followed by a string representation of the given path elements.
    Returns a string representation for this extensible enum describing a path type.
  • Field Details

    • UNRESOLVED

      static final PathType UNRESOLVED
      The type for all paths that could not be placed in any of the types requested by a caller. This type can appear in the return value of a call to resolveDependencies(...) when at least one dependency cannot be associated to any type specified in the desiredTypes argument. Plugins can choose to report a warning to users when unresolved paths exist.
  • Method Details

    • id

      Returns the unique name of this path type, including the module to patch if any. For example, if this type is JavaPathType.MODULES, then this method returns "MODULES". But if this type was created by JavaPathType.patchModule("foo.bar"), then this method returns "PATCH_MODULE:foo.bar".
      Returns:
      the programmatic name together with the module name on which it applies
      See Also:
    • option

      Returns the name of the tool option for this path. For example, if this path type is JavaPathType.MODULES, then this method returns "--module-path". The option does not include the module name on which it applies.
      Returns:
      the name of the tool option for this path type
    • option

      @Nonnull String[] option(Iterable<? extends Path> paths)
      Returns the option followed by a string representation of the given path elements. The path elements are separated by an option-specific or platform-specific separator. If the given paths argument contains no element, then this method returns an empty string.

      Examples

      If paths is a list containing two elements, dir/path1 and dir/path2, then:
      • If this type is JavaPathType.MODULES, then this method returns {"--module-path", "dir/path1:dir/path2"} on Unix or {"--module-path", "dir\path1;dir\path2"} on Windows.
      • If this type was created by JavaPathType.patchModule("foo.bar"), then the method returns {"--patch-module", "foo.bar=dir/path1:dir/path2"} on Unix or {"--patch-module", "foo.bar=dir\path1;dir\path2"} on Windows.
      Parameters:
      paths - the path to format as a string
      Returns:
      the option associated to this path type followed by the given path elements, or an empty array if there is no path element.
    • name

      Returns the name of this path type. For example, if this path type is JavaPathType.MODULES, then this method returns "MODULES".
      Returns:
      the programmatic name of this path type
    • toString

      @Nonnull String toString()
      Returns a string representation for this extensible enum describing a path type.. For example "PathType[PATCH_MODULE:foo.bar]".
      Overrides:
      toString in class Object
      Returns:
      a string representation for this extensible enum describing a path type