public class BooleanOptionHandler extends java.lang.Object implements CmdOptionHandler
Boolean
(or boolean
)
field. If the option is present, the field will be evaluated to
true
.Constructor and Description |
---|
BooleanOptionHandler() |
Modifier and Type | Method and Description |
---|---|
void |
applyParams(java.lang.Object config,
java.lang.reflect.AccessibleObject element,
java.lang.String[] args,
java.lang.String optionName)
Apply the option and it arguments (if any) to the field or method
representing the option.
|
boolean |
canHandle(java.lang.reflect.AccessibleObject element,
int argCount)
Return
true if the field or method (element )
with the given number of arguments (argCount ) can be handled
by this handler. |
public void applyParams(java.lang.Object config, java.lang.reflect.AccessibleObject element, java.lang.String[] args, java.lang.String optionName)
CmdOptionHandler
applyParams
in interface CmdOptionHandler
config
- The object containing the field or element to which the parsed
values should be applied.element
- The element itself (field or method) to apply to.args
- The parsed arguments of the option.optionName
- The actual name of the currently handled option. This is only
required to create good error messages.public boolean canHandle(java.lang.reflect.AccessibleObject element, int argCount)
CmdOptionHandler
true
if the field or method (element
)
with the given number of arguments (argCount
) can be handled
by this handler.canHandle
in interface CmdOptionHandler
element
- The field or method that represents an command line option.argCount
- The number or arguments the command line option supports.true
if the option can be parsed and applied by this
handler.