Tool providers are normally located using the service-provider
loading facility defined by ServiceLoader
.
Each provider must provide a name, and a method to run
an instance of the corresponding tool. When a tool is run,
it will be provided with an array of string arguments, and a
pair of streams: one for normal (or expected) output and the other
for reporting any errors that may occur.
The interpretation of the string arguments will normally be defined by
each individual tool provider, but will generally correspond to the
arguments that could be provided to the tool when invoking the tool
from the command line.
Modifier and Type | Method and Description |
---|---|
public default Optional | Returns: a short description of the tool, or an emptyOptional if no description is availableReturns a short description of the tool, or an empty
|
public static Optional | Returns: anOptional<ToolProvider> of the first instance foundthe name of the desired tool provider name)Returns the first instance of a |
public String | |
public int | Returns: the result of executing the tool. A return value of 0 means the tool did not encounter any errors; any other value indicates that at least one error occurred during execution.a stream to which "expected" output should be written out, PrintWriter a stream to which any error messages should be written err, String... the command-line arguments for the tool args)Runs an instance of the tool, returning zero for a successful run. |
public default int | Returns: the result of executing the tool. A return value of 0 means the tool did not encounter any errors; any other value indicates that at least one error occurred during execution.a stream to which "expected" output should be written out, PrintStream a stream to which any error messages should be written err, String... the command-line arguments for the tool args)Runs an instance of the tool, returning zero for a successful run. |
description | back to summary |
---|---|
public default Optional Returns a short description of the tool, or an empty
API Note It is recommended that the description fits into a single line in order to allow creating concise overviews like the following:
Implementation Specification This implementation returns an empty |
findFirst | back to summary |
---|---|
public static Optional Returns the first instance of a
|
name | back to summary |
---|---|
public String name() Returns the name of this tool provider. API Note It is recommended that the name be the same as would be used on the command line: for example, "javac", "jar", "jlink".
|
run | back to summary |
---|---|
public int run(PrintWriter out, PrintWriter err, String... args) Runs an instance of the tool, returning zero for a successful run. Any non-zero return value indicates a tool-specific error during the execution. Two streams should be provided, for "expected" output, and for any error messages. If it is not necessary to distinguish the output, the same stream may be used for both. API Note The interpretation of the arguments will be specific to each tool.
|
run | back to summary |
---|---|
public default int run(PrintStream out, PrintStream err, String... args) Runs an instance of the tool, returning zero for a successful run. Any non-zero return value indicates a tool-specific error during the execution. Two streams should be provided, for "expected" output, and for any error messages. If it is not necessary to distinguish the output, the same stream may be used for both. API Note The interpretation of the arguments will be specific to each tool. Implementation Note This implementation wraps the
|