public class OptionHandlerRegistry extends Object
getRegistry()
call.Modifier and Type | Class and Description |
---|---|
static interface |
OptionHandlerRegistry.OptionHandlerFactory
Provide custom logic for creating
OptionHandler implementation. |
Modifier and Type | Method and Description |
---|---|
protected OptionHandler |
createOptionHandler(CmdLineParser parser,
OptionDef o,
Setter setter)
|
static OptionHandlerRegistry |
getRegistry()
Gets the option handler registry singleton instance.
|
void |
registerHandler(Class valueType,
Class<? extends OptionHandler> handlerClass)
Registers a user-defined
OptionHandler class with args4j. |
void |
registerHandler(Class valueType,
OptionHandlerRegistry.OptionHandlerFactory factory)
Registers a user-defined
OptionHandler class with args4j. |
public static OptionHandlerRegistry getRegistry()
public void registerHandler(Class valueType, Class<? extends OptionHandler> handlerClass)
OptionHandler
class with args4j.
This method allows users to extend the behavior of args4j by writing
their own OptionHandler
implementation.
valueType
- The specified handler is used when the field/method annotated by Option
is of this type.handlerClass
- This class must have the constructor that has the same signature as
OptionHandler.OptionHandler(CmdLineParser, OptionDef, Setter)
NullPointerException
- if valueType
or handlerClass
is null
.IllegalArgumentException
- if handlerClass
is not a subtype of OptionHandler
.public void registerHandler(Class valueType, OptionHandlerRegistry.OptionHandlerFactory factory)
OptionHandler
class with args4j.
This method allows users to extend the behavior of args4j by writing
their own OptionHandler
implementation.
valueType
- The specified handler is used when the field/method annotated by Option
is of this type.factory
- Factory to instantiate handler upon request.NullPointerException
- if valueType
or factory
is null
.protected OptionHandler createOptionHandler(CmdLineParser parser, OptionDef o, Setter setter)
Copyright © 2003-2016 Kohsuke Kawaguchi. All Rights Reserved.