org.springframework.core.env
Class CommandLineArgs

java.lang.Object
  extended by org.springframework.core.env.CommandLineArgs

 class CommandLineArgs
extends java.lang.Object

A simple representation of command line arguments, broken into "option arguments" and "non-option arguments".

Since:
3.1
Author:
Chris Beams
See Also:
SimpleCommandLineArgsParser

Field Summary
private  java.util.List<java.lang.String> nonOptionArgs
           
private  java.util.Map<java.lang.String,java.util.List<java.lang.String>> optionArgs
           
 
Constructor Summary
CommandLineArgs()
           
 
Method Summary
 void addNonOptionArg(java.lang.String value)
          Add the given value to the list of non-option arguments.
 void addOptionArg(java.lang.String optionName, java.lang.String optionValue)
          Add an option argument for the given option name and add the given value to the list of values associated with this option (of which there may be zero or more).
 boolean containsOption(java.lang.String optionName)
          Return whether the option with the given name was present on the command line.
 java.util.List<java.lang.String> getNonOptionArgs()
          Return the list of non-option arguments specified on the command line.
 java.util.Set<java.lang.String> getOptionNames()
          Return the set of all option arguments present on the command line.
 java.util.List<java.lang.String> getOptionValues(java.lang.String optionName)
          Return the list of values associated with the given option.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

optionArgs

private final java.util.Map<java.lang.String,java.util.List<java.lang.String>> optionArgs

nonOptionArgs

private final java.util.List<java.lang.String> nonOptionArgs
Constructor Detail

CommandLineArgs

CommandLineArgs()
Method Detail

addOptionArg

public void addOptionArg(java.lang.String optionName,
                         java.lang.String optionValue)
Add an option argument for the given option name and add the given value to the list of values associated with this option (of which there may be zero or more). The given value may be null, indicating that the option was specified without an associated value (e.g. "--foo" vs. "--foo=bar").


getOptionNames

public java.util.Set<java.lang.String> getOptionNames()
Return the set of all option arguments present on the command line.


containsOption

public boolean containsOption(java.lang.String optionName)
Return whether the option with the given name was present on the command line.


getOptionValues

public java.util.List<java.lang.String> getOptionValues(java.lang.String optionName)
Return the list of values associated with the given option. null signifies that the option was not present; empty list signifies that no values were associated with this option.


addNonOptionArg

public void addNonOptionArg(java.lang.String value)
Add the given value to the list of non-option arguments.


getNonOptionArgs

public java.util.List<java.lang.String> getNonOptionArgs()
Return the list of non-option arguments specified on the command line.