Class Classpath

java.lang.Object
org.savantbuild.lang.Classpath

public class Classpath extends Object
Models a Classpath.
  • Field Details

  • Constructor Details

    • Classpath

      public Classpath(String... paths)
      Constructs a Classpath with the given initial parts.
      Parameters:
      paths - The paths to add to the Classpath on construction.
  • Method Details

    • path

      public Classpath path(String path)
      Adds the given path to the Classpath.
      Parameters:
      path - The path to add.
      Returns:
      This Classpath.
    • path

      public Classpath path(Path path)
      Adds the given path to the Classpath.
      Parameters:
      path - The path to add.
      Returns:
      This Classpath.
    • path

      public Classpath path(File file)
      Adds the given path to the Classpath.
      Parameters:
      file - The file to add.
      Returns:
      This Classpath.
    • paths

      public Classpath paths(Path... paths)
      Adds all the given paths to the Classpath.
      Parameters:
      paths - The paths to add to the Classpath.
      Returns:
      This Classpath.
    • toString

      public String toString()
      Converts this Classpath to a String by joining the paths using the File.separator. If the Classpath is empty, this returns an empty String.
      Overrides:
      toString in class Object
      Returns:
      The Classpath as a String or an empty String.
    • toString

      public String toString(String prefix)
      Converts this Classpath to a String by joining the paths using the File.separator and adding the prefix to the start. If the Classpath is empty, this returns an empty String.
      Parameters:
      prefix - The prefix of the String (usually '-classpath ').
      Returns:
      The Classpath as a String or an empty String.
    • toURLClassLoader

      public URLClassLoader toURLClassLoader() throws IllegalStateException
      Throws:
      IllegalStateException