Class OptionHandlerRegistry
java.lang.Object
org.kohsuke.args4j.OptionHandlerRegistry
Manages the registration of option handlers.
This is good for registering custom handlers
for specific parameter classes not yet implemented.
The registry is a singleton that can be
retrieved with the
getRegistry() call.- Author:
- Stephan Fuhrmann
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceProvide custom logic for creatingOptionHandlerimplementation. -
Method Summary
Modifier and TypeMethodDescriptionprotected OptionHandlercreateOptionHandler(CmdLineParser parser, OptionDef o, Setter setter) static OptionHandlerRegistryGets the option handler registry singleton instance.voidregisterHandler(Class valueType, Class<? extends OptionHandler> handlerClass) Registers a user-definedOptionHandlerclass with args4j.voidregisterHandler(Class valueType, OptionHandlerRegistry.OptionHandlerFactory factory) Registers a user-definedOptionHandlerclass with args4j.
-
Method Details
-
getRegistry
Gets the option handler registry singleton instance.- Returns:
- a shared instance of the registry.
-
registerHandler
Registers a user-definedOptionHandlerclass with args4j.This method allows users to extend the behavior of args4j by writing their own
OptionHandlerimplementation.- Parameters:
valueType- The specified handler is used when the field/method annotated byOptionis of this type.handlerClass- This class must have the constructor that has the same signature asOptionHandler(CmdLineParser, OptionDef, Setter)- Throws:
NullPointerException- ifvalueTypeorhandlerClassisnull.IllegalArgumentException- ifhandlerClassis not a subtype ofOptionHandler.
-
registerHandler
Registers a user-definedOptionHandlerclass with args4j.This method allows users to extend the behavior of args4j by writing their own
OptionHandlerimplementation.- Parameters:
valueType- The specified handler is used when the field/method annotated byOptionis of this type.factory- Factory to instantiate handler upon request.- Throws:
NullPointerException- ifvalueTypeorfactoryisnull.
-
createOptionHandler
-