Interface CommandLine
-
- All Known Implementing Classes:
DefaultCommandLine,ScriptCommandLine
public interface CommandLineQuotes command line arguments.- Since:
- 2.0
- Author:
- Erwin Mueller, erwin.mueller@deventm.org
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CommandLineadd(boolean quote, Object argument)Adds the specified command line argument.CommandLineadd(boolean quote, Object... arguments)Adds the specified command line arguments.CommandLineadd(Object argument)Adds the specified command line argument.CommandLineadd(Object... arguments)Adds the specified command line arguments.CommandLineaddSub(String name, Object value)Adds a variable substitution for the arguments.List<String>getArguments()Returns the arguments.List<String>getCommand()Returns the of the command list.ObjectgetExecutable()Returns the executable.FilegetWorkingDir()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.StringtoString()
-
-
-
Method Detail
-
getCommand
List<String> getCommand() throws CommandExecException
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
List<String> getArguments()
Returns the arguments.- Returns:
- the unmodifiable
Listof arguments.
-
add
CommandLine add(Object... arguments)
Adds the specified command line arguments.- Parameters:
arguments- theObjectarray arguments.- Returns:
- this
DefaultCommandLine.
-
add
CommandLine add(boolean quote, Object... arguments)
Adds the specified command line arguments.- Parameters:
quote- set totrueto quote the argument.arguments- theObjectarray arguments.- Returns:
- this
DefaultCommandLine.
-
add
CommandLine add(Object argument)
Adds the specified command line argument.- Parameters:
argument- theObjectargument.- Returns:
- this
DefaultCommandLine.
-
add
CommandLine add(boolean quote, Object argument)
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
CommandLine addSub(String name, Object value)
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
void setWorkingDir(File dir)
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.
-
-