org.schmant.support.io
Class ArgumentList

java.lang.Object
  extended by org.schmant.support.io.ArgumentList

public class ArgumentList
extends Object

Objects of this class is used for building an command and argument list that is used for running an external command. The add(java.lang.String) method is responsible for quoting and escaping the contents of the string as necessary.

Since:
0.5
Author:
Karl Gustafsson

Constructor Summary
ArgumentList(boolean quoteStringsWSpaces)
          Create the argument list.
 
Method Summary
 ArgumentList add(String arg)
          Add one argument to the list.
 ArgumentList addAll(ArgumentList al)
          Add all arguments in the supplied argument list.
 ArgumentList addAll(Collection<String> c)
          Add a collection of arguments to the list.
 List<String> getArgumentList()
          Get the argument list.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArgumentList

public ArgumentList(boolean quoteStringsWSpaces)
Create the argument list.

Parameters:
quoteStringsWSpaces - Should an added string containing spaces be quoted?
Method Detail

add

public ArgumentList add(String arg)
Add one argument to the list. If there are characters that need to be escaped in the argument, this method takes care of that.

Parameters:
arg - The argument. null arguments are allowed.
Returns:
this

addAll

public ArgumentList addAll(Collection<String> c)
Add a collection of arguments to the list. The arguments are added in the order that they are returned when iterating over the collection. If there are characters that need to be escaped in the arguments, this method takes care of that.

Parameters:
c - The argument collection.
Returns:
this

addAll

public ArgumentList addAll(ArgumentList al)
Add all arguments in the supplied argument list. The arguments are assumed to be processed already, and are added as-is.

Parameters:
al - The argument list to add arguments from.
Returns:
this

getArgumentList

public List<String> getArgumentList()
Get the argument list.

Returns:
The argument list.

toString

public String toString()
Overrides:
toString in class Object