|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.fhg.igd.logging.CommandLineInterface
This class is a simple parser for command line arguments. It provides
a command line interface for the LoggingConfiguration
by defining
and "publishing" a set of public
methods (whose
parameters need to be exclusively of type String
).
Published methods are defined by descriptors
(which are simple String
objects). The syntax is:
"<method-name>,<number-of-parameters>['*']"
where
Field Summary | |
protected static CommandLineInterface |
instance_
The singleton instance |
protected static String[] |
OPTION_DESCR_
The option descriptors |
protected Map |
options_
The map of available options; Method objects are used as keys,
Boolean objects (representing the repeatable flag) as values |
Constructor Summary | |
private |
CommandLineInterface()
Create a CommandLineInterface . |
Method Summary | |
protected Object |
call(Method method,
String[] params)
Invoke the given method on the current configuration . |
static CommandLineInterface |
getInstance()
Get the singleton instance. |
void |
process(String[] args)
Parse the given command line arguments and process the detected options. |
protected void |
process(String option,
List params)
Create one or more calls from an option. |
String |
toString()
|
static String |
usage()
Get usage information. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static final String[] OPTION_DESCR_
protected Map options_
Method
objects are used as keys,
Boolean
objects (representing the repeatable flag) as values
protected static CommandLineInterface instance_
Constructor Detail |
private CommandLineInterface()
CommandLineInterface
.
Since this class is a singleton, getInstance()
should be used.
IllegalArgumentException
- if the option descriptor is invalidMethod Detail |
public static CommandLineInterface getInstance()
CommandLineInterface
public void process(String[] args)
args
- The command line arguments
LoggingException
- if parsing the command line arguments or
processing an option failedprotected void process(String option, List params)
option
- The option to processparams
- The parameters of the given option
LoggingException
- if the option could not be processedprotected Object call(Method method, String[] params)
current configuration
.
method
- The method to be invokedparams
- The parameters to be passed to the method
LoggingException
- if an exception was thrown by the called method
UnsupportedOperationException
- if calling the requested method
failedpublic static String usage()
public String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |