|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.util.CommandLineArguments
public class CommandLineArguments
Helper class for parsing command line arguments. It allows for the parsing of attributes, that are preceded by a '-' and the main argument, that is not preceded by an identifier.
Constructor Summary | |
---|---|
CommandLineArguments()
Creates a new instance of CommandLineArguments |
Method Summary | |
---|---|
void |
addArgument(java.lang.String name,
java.lang.String defaultValue)
Tell the parser to treat '-name xxxx' as a key value pair. |
void |
addOption(java.lang.String name)
tell the parser to treat the '-name' option as a boolean option |
java.lang.String |
getArgument(java.lang.String name)
returns the string value of the option named 'name' |
java.lang.String |
getMainArgument()
Getter for property mainArgument. |
java.util.Map |
getOptionMap()
Getter for property optionMap. |
boolean |
hasMainArgument()
Returns whether or not the main argument is set. |
void |
initFromArguments(java.lang.String[] args)
parses the command line arguments and fills the internal map using the given values |
boolean |
isArgumentSet(java.lang.String name)
whether or not the argument 'name' is available |
boolean |
isOptionSet(java.lang.String name)
queries the value of the switch named 'name' |
void |
setMainArgument(java.lang.String mainArgument)
Setter for property mainArgument. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CommandLineArguments()
Method Detail |
---|
public void initFromArguments(java.lang.String[] args)
args
- command line argumentspublic java.util.Map getOptionMap()
public void addOption(java.lang.String name)
name
- the name of the boolean optionpublic java.lang.String getMainArgument()
public void setMainArgument(java.lang.String mainArgument)
mainArgument
- New value of property mainArgument.public boolean hasMainArgument()
public void addArgument(java.lang.String name, java.lang.String defaultValue)
name
- the keydefaultValue
- the default valuepublic boolean isOptionSet(java.lang.String name)
name
- the name
public java.lang.String getArgument(java.lang.String name)
name
- the name of the option
public boolean isArgumentSet(java.lang.String name)
name
- the name of the argument
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |