|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjcmdline.AbstractHandlerDecorator
jcmdline.VersionCmdLineHandler
A CmdLineHandler Decorator class that implements a -version option.
The implemented option is a BooleanParam whose tag is defined by "VersionCmdLineHandler.version.tag" in the strings.properties file (set to "version", in English).
Should the user specify this option on the command line, the command's
version is printed to stdout, and System.exit(0)
is called.
Information on using CmdLineHandlers can be found in the jcmdline User Guide.
CmdLineHandler
,
AbstractHandlerDecorator
Constructor Summary | |
VersionCmdLineHandler(java.lang.String version,
CmdLineHandler handler)
constructor |
|
VersionCmdLineHandler(java.lang.String version,
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 |
|
VersionCmdLineHandler(java.lang.String version,
java.lang.String cmdName,
java.lang.String cmdDesc,
Parameter[] options,
Parameter[] args)
constructor - creates a new DefaultCmdLineHandler as its delegate |
|
VersionCmdLineHandler(java.lang.String version,
java.lang.String cmdName,
java.lang.String cmdDesc,
Parameter[] options,
Parameter[] args,
CmdLineParser parser)
constructor - creates a new DefaultCmdLineHandler as its delegate |
Method Summary | |
protected boolean |
processParsedOptions(boolean parseOk)
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 VersionCmdLineHandler(java.lang.String version, CmdLineHandler handler)
version
- the command's versionhandler
- the CmdLineHandler to which most functionality
will be delegated
java.lang.IllegalArgumentException
- if version
is null or
empty.public VersionCmdLineHandler(java.lang.String version, java.lang.String cmdName, java.lang.String cmdDesc, Parameter[] options, Parameter[] args, CmdLineParser parser)
version
- the command's versioncmdName
- 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.DefaultCmdLineHandler
public VersionCmdLineHandler(java.lang.String version, java.lang.String cmdName, java.lang.String cmdDesc, Parameter[] options, Parameter[] args)
version
- the command's versioncmdName
- 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.DefaultCmdLineHandler
public VersionCmdLineHandler(java.lang.String version, java.lang.String cmdName, java.lang.String cmdDesc, java.util.Collection options, java.util.Collection args)
version
- the command's versioncmdName
- the name of the command creating this
DefaultCmdLineHandlercmdDesc
- 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 parseOk)
parse()
of this class's
contained CmdLineHandler. This method only checks for its option if
parseStatus
is true.
processParsedOptions
in class AbstractHandlerDecorator
parseOk
- the results of the parse() call. Note that
if dieOnParseError
is set, or some
other AbstractHandlerDecorator exits first, this
method may never be called.
System.exit(0)
, rather
than returning, if its option is set.
Otherwise, parseStatus
is returned.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |