org.springframework.core.env
Class SimpleCommandLineArgsParser

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

 class SimpleCommandLineArgsParser
extends java.lang.Object

Parses a String[] of command line arguments in order to populate a CommandLineArgs object.

Working with option arguments

Option arguments must adhere to the exact syntax:
--optName[=optValue]
That is, options must be prefixed with "--", and may or may not specify a value. If a value is specified, the name and value must be separated without spaces by an equals sign ("=").

Valid examples of option arguments

 --foo
 --foo=bar
 --foo="bar then baz"
 --foo=bar,baz,biz

Invalid examples of option arguments

 -foo
 --foo bar
 --foo = bar
 --foo=bar --foo=baz --foo=biz

Working with non-option arguments

Any and all arguments specified at the command line without the "--" option prefix will be considered as "non-option arguments" and made available through the CommandLineArgs.getNonOptionArgs() method.

Since:
3.1
Author:
Chris Beams

Constructor Summary
SimpleCommandLineArgsParser()
           
 
Method Summary
 CommandLineArgs parse(java.lang.String... args)
          Parse the given String array based on the rules described above, returning a fully-populated CommandLineArgs object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleCommandLineArgsParser

SimpleCommandLineArgsParser()
Method Detail

parse

public CommandLineArgs parse(java.lang.String... args)
Parse the given String array based on the rules described above, returning a fully-populated CommandLineArgs object.

Parameters:
args - command line arguments, typically from a main() method