org.ow2.jasmine.monitoring.eventswitch.extractor
Class ArgumentParser

java.lang.Object
  extended by org.ow2.jasmine.monitoring.eventswitch.extractor.ArgumentParser

public class ArgumentParser
extends java.lang.Object

Parses command line arguments.

Author:
http://www.devx.com/tips/Tip/13004

Constructor Summary
ArgumentParser(java.lang.String[] args)
          Initializes the command line argument parser based on the command line arguments.
 
Method Summary
 java.lang.String getOption(java.lang.String o)
          Gets the value of an option.
 java.util.Hashtable<java.lang.String,java.lang.String> getOptions()
           
 boolean hasParameter(java.lang.String p)
          Checks if a parameter has been set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArgumentParser

public ArgumentParser(java.lang.String[] args)
Initializes the command line argument parser based on the command line arguments. By default, we consider two cases: 1. An option, which starts with a - or a /, followed by the name of the option, a space and the value. For example: -jasmine vm://eventSwitch In that case, getOption("jasmine").equals("vm://eventSwitch"). 2. A parameter, which only sets a certain property. For example: poll In that case, hasParameter("poll") == true.

Parameters:
args - Arguments passed to main(String[]).
Method Detail

getOption

public java.lang.String getOption(java.lang.String o)
Gets the value of an option.

Parameters:
o - Option name to look for.
Returns:
Value of that option, null if none found.

hasParameter

public boolean hasParameter(java.lang.String p)
Checks if a parameter has been set.

Parameters:
p - Parameter name to look for.
Returns:
true if parameter p has been set, false otherwise.

getOptions

public java.util.Hashtable<java.lang.String,java.lang.String> getOptions()
Returns:
All options.


Copyright © 2008 OW2 Consortium. All Rights Reserved.