public class ArgProcessor
extends java.lang.Object
ArgProcessor is a generic argument processor for single character options
to be passed in into a command line program.
The usage is inspired by Perls option handling| Constructor and Description |
|---|
ArgProcessor() |
| Modifier and Type | Method and Description |
|---|---|
void |
defineOptions(java.lang.String definitions)
defineOptions - with this method the allowed arguments are defined. |
java.lang.String |
getArgumentOption(java.lang.String option)
getArgumentOption - returns the value or the option |
java.lang.String[] |
getArguments()
getArguments - returns the real arguments; the command arguments |
boolean |
hasFlagOption(java.lang.String option)
hasFlagOption - returns if the flag option is set |
boolean |
hasOption(java.lang.String option)
hasOption - check if a certain option exists; the option can either be
a flag or an option with a value |
static void |
main(java.lang.String[] args)
main for command line testing purpose |
void |
putArguments(java.lang.String options)
putArguments - put a string containing all options and arguments separated by a
white space into the ArgumentProcessor |
void |
putArguments(java.lang.String[] options)
putArguments - put an array of options and arguments into the
ArgurmentProcessor. |
public static void main(java.lang.String[] args)
main for command line testing purposeargs - a String[] valuepublic void defineOptions(java.lang.String definitions)
defineOptions - with this method the allowed arguments are defined. They are passed
in one String. Arguments can be a trigger or have an associated argument value. Those one with a
value have are followed by a ':'Adefinitions - a String valuepublic void putArguments(java.lang.String[] options)
putArguments - put an array of options and arguments into the
ArgurmentProcessor. The array of options are concatenated into a long Sring --
then putArguments(String) is calledoptions - a String[] valuepublic void putArguments(java.lang.String options)
putArguments - put a string containing all options and arguments separated by a
white space into the ArgumentProcessoroptions - a String valuepublic boolean hasOption(java.lang.String option)
hasOption - check if a certain option exists; the option can either be
a flag or an option with a valueoption - a String valueboolean valuepublic boolean hasFlagOption(java.lang.String option)
hasFlagOption - returns if the flag option is setoption - a String valueboolean valuepublic java.lang.String getArgumentOption(java.lang.String option)
getArgumentOption - returns the value or the optionoption - a String valueString valuepublic java.lang.String[] getArguments()
getArguments - returns the real arguments; the command argumentsString[] value
JCSC is released under the terms of the GNU General Public License