public class CmdlineOptions extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
CmdlineOptions.ListenerIF
INTERNAL: A listener interface that must be implemented by object
that are interested in options found by the CmdlineOptions
instance.
|
static class |
CmdlineOptions.OptionsException
INTERNAL: An exception that is thrown when there are problems
with the options specified on the command line.
|
Modifier and Type | Field and Description |
---|---|
protected String |
application |
protected List<String> |
arguments |
protected String[] |
argv |
protected List<gnu.getopt.LongOpt> |
largs |
protected Map<Integer,CmdlineOptions.ListenerIF> |
listeners |
protected StringBuilder |
sargs |
Constructor and Description |
---|
CmdlineOptions(String application,
String[] argv) |
Modifier and Type | Method and Description |
---|---|
void |
addLong(CmdlineOptions.ListenerIF listener,
String name,
char c)
Add a long argumentless option with the specified listener.
|
void |
addLong(CmdlineOptions.ListenerIF listener,
String name,
char c,
boolean req_arg)
Add a long option with argument with the specified listener.
|
void |
addShort(CmdlineOptions.ListenerIF listener,
char c)
Add a short argumentless option with the specified listener.
|
void |
addShort(CmdlineOptions.ListenerIF listener,
char c,
boolean req_arg)
Add a short option with argument with the specified listener.
|
String[] |
getArguments()
Return non-option arguments that are remaining after parsing the
command line arguments.
|
void |
parse()
Parse the command line arguments and notify option listeners.
|
protected String application
protected String[] argv
protected StringBuilder sargs
protected List<gnu.getopt.LongOpt> largs
protected Map<Integer,CmdlineOptions.ListenerIF> listeners
public void addShort(CmdlineOptions.ListenerIF listener, char c)
public void addShort(CmdlineOptions.ListenerIF listener, char c, boolean req_arg)
public void addLong(CmdlineOptions.ListenerIF listener, String name, char c)
public void addLong(CmdlineOptions.ListenerIF listener, String name, char c, boolean req_arg)
public void parse() throws CmdlineOptions.OptionsException
CmdlineOptions.OptionsException
public String[] getArguments()