org.fuin.kickstart4j
Class CmdLineParser

java.lang.Object
  extended by org.fuin.kickstart4j.CmdLineParser

public final class CmdLineParser
extends java.lang.Object

Parses the command line and set the appropriate config object values.


Constructor Summary
CmdLineParser(java.util.Locale locale)
          Constructor with locale.
 
Method Summary
 void copyToConfig(Config config)
          Copy the parsed values to the configuration.
 java.lang.String get(java.lang.String key)
          Returns an option value by it's key.
static void main(java.lang.String[] args)
          Test method.
 void parse(java.lang.String[] args)
          Parse the command line and set the values in the target config object.
 void printUsage(java.io.OutputStream out)
          Prints the command line usage.
 void printUsage(java.io.PrintStream ps)
          Prints the command line usage.
 java.lang.String remove(java.lang.String key)
          Removes an option key.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CmdLineParser

public CmdLineParser(java.util.Locale locale)
Constructor with locale.

Parameters:
locale - Locale.
Method Detail

parse

public final void parse(java.lang.String[] args)
                 throws CmdLineException
Parse the command line and set the values in the target config object.

Parameters:
args - Command line arguments.
Throws:
CmdLineException - Illegal arguments or missing required arguments.

get

public java.lang.String get(java.lang.String key)
Returns an option value by it's key.

Parameters:
key - Key to find.
Returns:
Value or null if the key was not found.

remove

public java.lang.String remove(java.lang.String key)
Removes an option key.

Parameters:
key - Option to remove.
Returns:
Previously removed value.

copyToConfig

public void copyToConfig(Config config)
Copy the parsed values to the configuration.

Parameters:
config - Config to fill with parsed values.

printUsage

public final void printUsage(java.io.PrintStream ps)
Prints the command line usage.

Parameters:
ps - Stream to use.

printUsage

public final void printUsage(java.io.OutputStream out)
Prints the command line usage.

Parameters:
out - Stream to use.

toString

public final java.lang.String toString()

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
Test method.

Parameters:
args - Not used.


Copyright © 2010 Future Invent Informationsmanagement GmbH. All Rights Reserved.