public static interface Command.Builder
Command
objects. For users, the builder is a convenient
way to add arguments dynamically or provide a base set of arguments that
can be extended by other code. Builders can be reused to create multiple
Command
objects.
Each argument is converted to a string by calling toString
or
using the string "null"
if the argument is null
.
Escaping arguments is not required and may lead to unexpected behavior. Any system-dependent escaping is handled by the execution system when the resulting command is executed.
Modifier and Type | Method and Description |
---|---|
Command.Builder |
addArgument(Object arg)
Adds an argument to this command.
|
Command.Builder |
addArguments(List<?> args)
Adds arguments to this command.
|
Command.Builder |
addArguments(Object first,
Object second,
Object... more)
Adds arguments to this command.
|
Command |
build()
Builds a new
Command using the settings configured by this
builder. |
Command.Builder addArgument(Object arg)
arg
- the argument to addCommand.Builder addArguments(Object first, Object second, Object... more)
first
- the first argument to addsecond
- the second argument to addmore
- any additional arguments to addCommand.Builder addArguments(List<?> args)
args
- the arguments to addCommand build()
Command
using the settings configured by this
builder. The builder may be reused to create more commands after
calling this method.