@NotThreadSafe public interface CommandBuilderSupport<B extends CommandBuilderSupport<B>>
CommandBuilder
s and, for those plugins which choose to provide them, type-safe builders.Modifier and Type | Method and Description |
---|---|
<T> Command<T> |
build(CommandOutputHandler<T> outputHandler)
|
B |
clearEnvironment()
Clears any environment variables which have been set.
|
B |
defaultExitHandler()
Applies the default
CommandExitHandler . |
B |
defaultWorkDir()
Applies the default working directory, which is the working directory for the current Java process.
|
B |
defaultWorkingDirectory()
Deprecated.
in 6.4 for removal in 7.0. Use
defaultWorkDir() instead. |
B |
exitHandler(CommandExitHandler value)
Sets the
CommandExitHandler which should be invoked after the command exits. |
B |
removeEnvironment(String name)
Removes the environment variable with the provided
name if it has been set |
B |
withEnvironment(String name,
String value)
Adds an environment variable with the specified
name and value . |
B |
workDir(Path value)
Sets the working directory which should be used when the command is run.
|
B |
workDir(String value)
Sets the working directory which should be used when the command is run.
|
B |
workingDirectory(File value)
Deprecated.
in 6.4 for removal in 7.0. Use
workDir(Path) instead |
B |
workingDirectory(Path value)
Deprecated.
in 6.4 for removal in 7.0. Use
workDir(Path) instead |
B |
workingDirectory(String value)
Deprecated.
in 6.4 for removal in 7.0. Use
workDir(String) instead |
@Nonnull <T> Command<T> build(@Nonnull CommandOutputHandler<T> outputHandler)
Command
which, when executed
, will provide output to the provided
outputHandler
for processing.T
- type for the builderoutputHandler
- the handler to receive and process output from the command as it executesNullPointerException
- if the provided outputHandler
is null
@Nonnull B clearEnvironment()
this
@Nonnull B defaultExitHandler()
CommandExitHandler
. The default exit handler used is based on the builder in play;
each builder is free to define its own default exit handler.
Note: If no explicit exit handler is set
, the default will be applied
automatically when the command is built
; it is not possible to build a
command without an exit handler.
this
@Nonnull B defaultWorkDir()
this
@Deprecated @Nonnull B defaultWorkingDirectory()
defaultWorkDir()
instead.this
@Nonnull B exitHandler(@Nonnull CommandExitHandler value)
CommandExitHandler
which should be invoked after the command exits. This handler receives:
Throwable
thrown during processingvalue
- the handler which should be invoked when the command exitsthis
NullPointerException
- if the provided value
is null
@Nonnull B removeEnvironment(@Nonnull String name)
name
if it has been setname
- the name of the environment variable to clearthis
IllegalArgumentException
- if name
is empty or blankNullPointerException
- if name
is null
@Nonnull B withEnvironment(@Nonnull String name, @Nonnull String value)
name
and value
. Both parameters are required,
and an exception will be thrown if either is not provided.name
- the name of the environment variable to setvalue
- the value to set for the environment variablethis
IllegalArgumentException
- if name
or value
is empty or blankNullPointerException
- if name
or value
is null
@Nonnull B workDir(@Nonnull Path value)
value
- the desired working directorythis
IllegalArgumentException
- if value
references a nonexistent path, or a fileNullPointerException
- if the provided value
is null
@Nonnull B workDir(@Nonnull String value)
value
- the desired working directorythis
IllegalArgumentException
- if value
references a nonexistent path, or a fileNullPointerException
- if the provided value
is null
@Deprecated @Nonnull B workingDirectory(@Nonnull File value)
workDir(Path)
insteadvalue
- the desired working directorythis
IllegalArgumentException
- if value
references a nonexistent path, or a fileNullPointerException
- if the provided value
is null
@Deprecated @Nonnull B workingDirectory(@Nonnull Path value)
workDir(Path)
insteadvalue
- the desired working directorythis
IllegalArgumentException
- if value
references a nonexistent path, or a fileNullPointerException
- if the provided value
is null
@Deprecated @Nonnull B workingDirectory(@Nonnull String value)
workDir(String)
insteadvalue
- the absolute path to the desired working directorythis
IllegalArgumentException
- if value
references a nonexistent path, or a fileNullPointerException
- if the provided value
is null
Copyright © 2019 Atlassian. All rights reserved.