Interface CommandLine
- All Known Implementing Classes:
DefaultCommandLine,ScriptCommandLine
public interface CommandLine
Quotes command line arguments.
- Since:
- 2.0
- Author:
- Erwin Mueller, erwin.mueller@deventm.org
-
Method Summary
Modifier and TypeMethodDescriptionAdds the specified command line argument.Adds the specified command line arguments.Adds the specified command line argument.Adds the specified command line arguments.Adds a variable substitution for the arguments.Returns the arguments.Returns the of the command list.Returns the executable.Returns the working directory.voidsetVariableStartChar(char character) Sets the variable substitution start character.voidsetVariableStopChar(char character) Sets the variable substitution stop character.voidsetWorkingDir(File dir) Sets the working directory.toString()
-
Method Details
-
getCommand
Returns the of the command list.- Returns:
- the unmodifiable
ListofStringthat contains the executable as the first item and the command arguments as the rest. - Throws:
CommandExecException- if there was an error create the command.
-
getExecutable
Object getExecutable()Returns the executable.- Returns:
- the
Objectexecutable to run, can be the name of the executable or the path or any other abstract object.
-
getArguments
Returns the arguments.- Returns:
- the unmodifiable
Listof arguments.
-
add
Adds the specified command line arguments.- Parameters:
arguments- theObjectarray arguments.- Returns:
- this
DefaultCommandLine.
-
add
Adds the specified command line arguments.- Parameters:
quote- set totrueto quote the argument.arguments- theObjectarray arguments.- Returns:
- this
DefaultCommandLine.
-
add
Adds the specified command line argument.- Parameters:
argument- theObjectargument.- Returns:
- this
DefaultCommandLine.
-
add
Adds the specified command line argument. If the quote arguments is set then the arguments is quoted in double/single quotes.aaa->aaaaaa bbb->"aaa bbb""aaa" bbb->'"aaa" bbb'"aaa ccc" bbb->'"aaa ccc" bbb'"aaa"bbb->'"aaa"bbb'
- Parameters:
argument- theObjectargument.quote- set totrueto quote the argument.- Returns:
- this
DefaultCommandLine.
-
addSub
Adds a variable substitution for the arguments. The variables are only substituted when the arguments are returned. The variables must be enclosed in the enclose"<", ">", for example:"foo=<bar>".- Parameters:
name- theStringname of the variable.value- theObjectvalue of the variable.- Returns:
- this
DefaultCommandLine.
-
setWorkingDir
Sets the working directory.- Parameters:
dir- theFiledirectory ornullto use the working directory of the current Java process.
-
getWorkingDir
File getWorkingDir()Returns the working directory.- Returns:
- the
Filedirectory ornullto use the working directory of the current Java process.
-
setVariableStartChar
void setVariableStartChar(char character) Sets the variable substitution start character. The start character defaults to"<".- Parameters:
character- the character.
-
setVariableStopChar
void setVariableStopChar(char character) Sets the variable substitution stop character. The stop character defaults to">".- Parameters:
character- the character.
-
toString
String toString()
-