|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjcmdline.AbstractHandlerDecorator
jcmdline.DefaultCmdLineHandler
A Decorator class that implements command line options for the display of the command's usage. These options are (using the default 'strings' properties file):
-? prints usage to stdout (optional) -h prints usage to stdout (optional) -h! prints usage (including hidden options) to stdout (optional) (hidden)
Should any of these options be specified by the user, the usage (with or without the hidden options, as appropriate) will be displayed and System.exit(0) will be called.
Information on using CmdLineHandlers can be found in the jcmdline User Guide.
Parameter
,
BasicCmdLineHandler
,
CmdLineParser
Constructor Summary | |
DefaultCmdLineHandler(CmdLineHandler handler)
constructor |
|
DefaultCmdLineHandler(java.lang.String cmdName,
java.lang.String cmdDesc,
java.util.Collection options,
java.util.Collection args)
constructor - uses the PosixCmdLineParser to parse the command line |
|
DefaultCmdLineHandler(java.lang.String cmdName,
java.lang.String cmdDesc,
Parameter[] options,
Parameter[] args)
constructor - creates a new BasicCmdLineHandler as its delegate |
|
DefaultCmdLineHandler(java.lang.String cmdName,
java.lang.String cmdDesc,
Parameter[] options,
Parameter[] args,
CmdLineParser parser)
constructor - creates a new BasicCmdLineHandler as its delegate |
Method Summary | |
protected boolean |
processParsedOptions(boolean parseStatus)
Called following the call to parse() of this class's
contained CmdLineHandler. |
Methods inherited from class jcmdline.AbstractHandlerDecorator |
addArg, addOption, exitUsageError, getArg, getArgs, getCmdDesc, getCmdName, getCustomOptions, getDieOnParseError, getOption, getOptions, getParseError, getParser, getUsage, parse, setArgs, setCmdDesc, setCmdName, setCustomOptions, setDieOnParseError, setOptions, setParseError, setParser |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultCmdLineHandler(CmdLineHandler handler)
handler
- the CmdLineHandler to which most functionality
will be delegatedpublic DefaultCmdLineHandler(java.lang.String cmdName, java.lang.String cmdDesc, Parameter[] options, Parameter[] args, CmdLineParser parser)
cmdName
- the name of the commandcmdDesc
- a short description of the commandoptions
- a collection of Parameter objects, describing the
command's command-line optionsargs
- a collection of Parameter objects, describing the
command's command-line arguments (what is left on
the command line after all options and their
parameters have been processed)parser
- a CmdLineParser to be used to parse the command line
java.lang.IllegalArgumentException
- if any of the
parameters are not correctly specified.BasicCmdLineHandler
public DefaultCmdLineHandler(java.lang.String cmdName, java.lang.String cmdDesc, Parameter[] options, Parameter[] args)
cmdName
- the name of the commandcmdDesc
- a short description of the commandoptions
- a collection of Parameter objects, describing the
command's command-line optionsargs
- a collection of Parameter objects, describing the
command's command-line arguments (what is left on
the command line after all options and their
parameters have been processed)
java.lang.IllegalArgumentException
- if any of the
parameters are not correctly specified.BasicCmdLineHandler
public DefaultCmdLineHandler(java.lang.String cmdName, java.lang.String cmdDesc, java.util.Collection options, java.util.Collection args)
cmdName
- the name of the command creating this
BasicCmdLineHandlercmdDesc
- a short description of the command's purposeoptions
- a collection of Parameter objects, describing the
command's command-line optionsargs
- a collection of Parameter objects, describing the
command's command-line arguments (what is left on
the command line after all options and their
parameters have been processed)
java.lang.IllegalArgumentException
- if any of the
parameters are not correctly specified.setCmdName()
,
setCmdDesc()
,
setOptions()
,
PosixCmdLineParser
Method Detail |
protected boolean processParsedOptions(boolean parseStatus)
parse()
of this class's
contained CmdLineHandler. This method checks for its options even if
parseStatus
is false.
processParsedOptions
in class AbstractHandlerDecorator
parseStatus
- The result of the parse()
call to this
class's contained CmdLineHandler.
System.exit(0)
,
rather than returning, if one of its
supported options (-h, -h!, or -?) is
specified. Otherwise, parseStatus
is returned.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |