Package org.kohsuke.args4j
Class OptionHandlerRegistry
- java.lang.Object
 - 
- org.kohsuke.args4j.OptionHandlerRegistry
 
 
- 
public class OptionHandlerRegistry extends java.lang.ObjectManages 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 thegetRegistry()call.- Author:
 - Stephan Fuhrmann
 
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceOptionHandlerRegistry.OptionHandlerFactoryProvide custom logic for creatingOptionHandlerimplementation. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected OptionHandlercreateOptionHandler(CmdLineParser parser, OptionDef o, Setter setter)static OptionHandlerRegistrygetRegistry()Gets the option handler registry singleton instance.voidregisterHandler(java.lang.Class valueType, java.lang.Class<? extends OptionHandler> handlerClass)Registers a user-definedOptionHandlerclass with args4j.voidregisterHandler(java.lang.Class valueType, OptionHandlerRegistry.OptionHandlerFactory factory)Registers a user-definedOptionHandlerclass with args4j. 
 - 
 
- 
- 
Method Detail
- 
getRegistry
public static OptionHandlerRegistry getRegistry()
Gets the option handler registry singleton instance.- Returns:
 - a shared instance of the registry.
 
 
- 
registerHandler
public void registerHandler(java.lang.Class valueType, java.lang.Class<? extends OptionHandler> handlerClass)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:
 java.lang.NullPointerException- ifvalueTypeorhandlerClassisnull.java.lang.IllegalArgumentException- ifhandlerClassis not a subtype ofOptionHandler.
 
- 
registerHandler
public void registerHandler(java.lang.Class valueType, OptionHandlerRegistry.OptionHandlerFactory factory)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:
 java.lang.NullPointerException- ifvalueTypeorfactoryisnull.
 
- 
createOptionHandler
protected OptionHandler createOptionHandler(CmdLineParser parser, OptionDef o, Setter setter)
 
 - 
 
 -