T
- The type of the field that this OptionHandler
works with.BooleanOptionHandler
, EnumOptionHandler
, FileOptionHandler
, MapOptionHandler
, OneArgumentOptionHandler
, StopOptionHandler
, StringOptionHandler
public abstract class OptionHandler<T>
extends java.lang.Object
This class can be extended by application to support additional Java datatypes in option operands.
Implementation of this class needs to be registered to args4j by using
CmdLineParser.registerHandler(Class,Class)
Modifier and Type | Field | Description |
---|---|---|
OptionDef |
option |
The annotation.
|
CmdLineParser |
owner |
The owner to which this handler belongs to.
|
Setter<? super T> |
setter |
Object to be used for setting value.
|
Modifier | Constructor | Description |
---|---|---|
protected |
OptionHandler(CmdLineParser parser,
OptionDef option,
Setter<? super T> setter) |
Modifier and Type | Method | Description |
---|---|---|
abstract java.lang.String |
getDefaultMetaVariable() |
Gets the default meta variable name used to print the usage screen.
|
java.lang.String |
getMetaVariable(java.util.ResourceBundle rb) |
|
java.lang.String |
getNameAndMeta(java.util.ResourceBundle rb) |
|
abstract int |
parseArguments(Parameters params) |
Called if the option that this owner recognizes is found.
|
public final OptionDef option
public final CmdLineParser owner
protected OptionHandler(CmdLineParser parser, OptionDef option, Setter<? super T> setter)
public abstract int parseArguments(Parameters params) throws CmdLineException
params
- The rest of the arguments. This method can use this
object to access the arguments of the option if necessary.
The object is valid only during the method call.CmdLineException
public abstract java.lang.String getDefaultMetaVariable()
public final java.lang.String getMetaVariable(java.util.ResourceBundle rb)
public final java.lang.String getNameAndMeta(java.util.ResourceBundle rb)