/** * Registers a user-defined {@link OptionHandler} class with args4j. * * <p> * This method allows users to extend the behavior of args4j by writing * their own {@link OptionHandler} implementation. * * @param valueType * The specified handler is used when the field/method annotated by {@link Option} * is of this type. * @param handlerClass * This class must have the constructor that has the same signature as * {@link OptionHandler#OptionHandler(CmdLineParser, OptionDef, Setter)} * @throws NullPointerException if {@code valueType} or {@code handlerClass} is {@code null}. * @throws IllegalArgumentException if {@code handlerClass} is not a subtype of {@code OptionHandler}. * @deprecated You should use {@link OptionHandlerRegistry#registerHandler(java.lang.Class, java.lang.Class)} instead. */ public static void registerHandler( Class valueType, Class<? extends OptionHandler> handlerClass ) { checkNonNull(valueType, "valueType"); checkNonNull(handlerClass, "handlerClass"); OptionHandlerRegistry.getRegistry().registerHandler(valueType, handlerClass); }
/** * Gets the option handler registry singleton instance. * @return a shared instance of the registry. */ public synchronized static OptionHandlerRegistry getRegistry() { if (instance == null) { instance = new OptionHandlerRegistry(); } return instance; }
/** * Creates an {@link OptionHandler} that handles the given {@link Option} annotation * and the {@link Setter} instance. */ protected OptionHandler createOptionHandler(OptionDef o, Setter setter) { checkNonNull(o, "OptionDef"); checkNonNull(setter, "Setter"); return OptionHandlerRegistry.getRegistry().createOptionHandler(this, o, setter); }
registerHandler(Boolean.class,BooleanOptionHandler.class); registerHandler(boolean.class,BooleanOptionHandler.class); registerHandler(File.class,FileOptionHandler.class); registerHandler(URL.class, URLOptionHandler.class); registerHandler(URI.class, URIOptionHandler.class); registerHandler(Integer.class,IntOptionHandler.class); registerHandler(int.class,IntOptionHandler.class); registerHandler(Double.class, DoubleOptionHandler.class); registerHandler(double.class,DoubleOptionHandler.class); registerHandler(String.class,StringOptionHandler.class); registerHandler(Byte.class, ByteOptionHandler.class); registerHandler(byte.class, ByteOptionHandler.class); registerHandler(Character.class, CharOptionHandler.class); registerHandler(char.class, CharOptionHandler.class); registerHandler(Float.class, FloatOptionHandler.class); registerHandler(float.class, FloatOptionHandler.class); registerHandler(Long.class, LongOptionHandler.class); registerHandler(long.class, LongOptionHandler.class); registerHandler(Short.class, ShortOptionHandler.class); registerHandler(short.class, ShortOptionHandler.class); registerHandler(InetAddress.class, InetAddressOptionHandler.class); registerHandler(Pattern.class, PatternOptionHandler.class); registerHandler(Map.class,MapOptionHandler.class); registerHandler(p, PathOptionHandler.class); } catch (ClassNotFoundException e) {
/** * Constructs an option handler manager with the * default handlers initialized. */ private OptionHandlerRegistry() { initHandlers(); }
registerHandler(Boolean.class,BooleanOptionHandler.class); registerHandler(boolean.class,BooleanOptionHandler.class); registerHandler(File.class,FileOptionHandler.class); registerHandler(URL.class, URLOptionHandler.class); registerHandler(URI.class, URIOptionHandler.class); registerHandler(Integer.class,IntOptionHandler.class); registerHandler(int.class,IntOptionHandler.class); registerHandler(Double.class, DoubleOptionHandler.class); registerHandler(double.class,DoubleOptionHandler.class); registerHandler(String.class,StringOptionHandler.class); registerHandler(Byte.class, ByteOptionHandler.class); registerHandler(byte.class, ByteOptionHandler.class); registerHandler(Character.class, CharOptionHandler.class); registerHandler(char.class, CharOptionHandler.class); registerHandler(Float.class, FloatOptionHandler.class); registerHandler(float.class, FloatOptionHandler.class); registerHandler(Long.class, LongOptionHandler.class); registerHandler(long.class, LongOptionHandler.class); registerHandler(Short.class, ShortOptionHandler.class); registerHandler(short.class, ShortOptionHandler.class); registerHandler(InetAddress.class, InetAddressOptionHandler.class); registerHandler(Pattern.class, PatternOptionHandler.class); registerHandler(Map.class,MapOptionHandler.class); registerHandler(p, PathOptionHandler.class); } catch (ClassNotFoundException e) {
/** * Constructs an option handler manager with the * default handlers initialized. */ private OptionHandlerRegistry() { initHandlers(); }
/** * Registers a user-defined {@link OptionHandler} class with args4j. * * <p> * This method allows users to extend the behavior of args4j by writing * their own {@link OptionHandler} implementation. * * @param valueType * The specified handler is used when the field/method annotated by {@link Option} * is of this type. * @param handlerClass * This class must have the constructor that has the same signature as * {@link OptionHandler#OptionHandler(CmdLineParser, OptionDef, Setter)} * @throws NullPointerException if {@code valueType} or {@code handlerClass} is {@code null}. * @throws IllegalArgumentException if {@code handlerClass} is not a subtype of {@code OptionHandler}. * @deprecated You should use {@link OptionHandlerRegistry#registerHandler(java.lang.Class, java.lang.Class)} instead. */ public static void registerHandler( Class valueType, Class<? extends OptionHandler> handlerClass ) { checkNonNull(valueType, "valueType"); checkNonNull(handlerClass, "handlerClass"); OptionHandlerRegistry.getRegistry().registerHandler(valueType, handlerClass); }
/** * Creates an {@link OptionHandler} that handles the given {@link Option} annotation * and the {@link Setter} instance. */ protected OptionHandler createOptionHandler(OptionDef o, Setter setter) { checkNonNull(o, "OptionDef"); checkNonNull(setter, "Setter"); return OptionHandlerRegistry.getRegistry().createOptionHandler(this, o, setter); }
registerHandler(Boolean.class,BooleanOptionHandler.class); registerHandler(boolean.class,BooleanOptionHandler.class); registerHandler(File.class,FileOptionHandler.class); registerHandler(URL.class, URLOptionHandler.class); registerHandler(URI.class, URIOptionHandler.class); registerHandler(Integer.class,IntOptionHandler.class); registerHandler(int.class,IntOptionHandler.class); registerHandler(Double.class, DoubleOptionHandler.class); registerHandler(double.class,DoubleOptionHandler.class); registerHandler(String.class,StringOptionHandler.class); registerHandler(Byte.class, ByteOptionHandler.class); registerHandler(byte.class, ByteOptionHandler.class); registerHandler(Character.class, CharOptionHandler.class); registerHandler(char.class, CharOptionHandler.class); registerHandler(Float.class, FloatOptionHandler.class); registerHandler(float.class, FloatOptionHandler.class); registerHandler(Long.class, LongOptionHandler.class); registerHandler(long.class, LongOptionHandler.class); registerHandler(Short.class, ShortOptionHandler.class); registerHandler(short.class, ShortOptionHandler.class); registerHandler(InetAddress.class, InetAddressOptionHandler.class); registerHandler(Pattern.class, PatternOptionHandler.class); registerHandler(Map.class,MapOptionHandler.class); registerHandler(p, PathOptionHandler.class); } catch (ClassNotFoundException e) {
/** * Gets the option handler registry singleton instance. * @return a shared instance of the registry. */ public synchronized static OptionHandlerRegistry getRegistry() { if (instance == null) { instance = new OptionHandlerRegistry(); } return instance; }
/** * Constructs an option handler manager with the * default handlers initialized. */ private OptionHandlerRegistry() { initHandlers(); }
public LoaderOptions() { OptionHandlerRegistry.getRegistry().registerHandler(Level.class, Log4jLevelOptionHandler.class); }
/** * Creates an {@link OptionHandler} that handles the given {@link Option} annotation * and the {@link Setter} instance. */ protected OptionHandler createOptionHandler(OptionDef o, Setter setter) { checkNonNull(o, "OptionDef"); checkNonNull(setter, "Setter"); return OptionHandlerRegistry.getRegistry().createOptionHandler(this, o, setter); }
registerHandler(Boolean.class,BooleanOptionHandler.class); registerHandler(boolean.class,BooleanOptionHandler.class); registerHandler(File.class,FileOptionHandler.class); registerHandler(URL.class, URLOptionHandler.class); registerHandler(URI.class, URIOptionHandler.class); registerHandler(Integer.class,IntOptionHandler.class); registerHandler(int.class,IntOptionHandler.class); registerHandler(Double.class, DoubleOptionHandler.class); registerHandler(double.class,DoubleOptionHandler.class); registerHandler(String.class,StringOptionHandler.class); registerHandler(Byte.class, ByteOptionHandler.class); registerHandler(byte.class, ByteOptionHandler.class); registerHandler(Character.class, CharOptionHandler.class); registerHandler(char.class, CharOptionHandler.class); registerHandler(Float.class, FloatOptionHandler.class); registerHandler(float.class, FloatOptionHandler.class); registerHandler(Long.class, LongOptionHandler.class); registerHandler(long.class, LongOptionHandler.class); registerHandler(Short.class, ShortOptionHandler.class); registerHandler(short.class, ShortOptionHandler.class); registerHandler(InetAddress.class, InetAddressOptionHandler.class); registerHandler(Pattern.class, PatternOptionHandler.class); registerHandler(Map.class,MapOptionHandler.class); registerHandler(p, PathOptionHandler.class); } catch (ClassNotFoundException e) {
/** * Gets the option handler registry singleton instance. * @return a shared instance of the registry. */ public synchronized static OptionHandlerRegistry getRegistry() { if (instance == null) { instance = new OptionHandlerRegistry(); } return instance; }
/** * Constructs an option handler manager with the * default handlers initialized. */ private OptionHandlerRegistry() { initHandlers(); }
/** * Registers a user-defined {@link OptionHandler} class with args4j. * * <p> * This method allows users to extend the behavior of args4j by writing * their own {@link OptionHandler} implementation. * * @param valueType * The specified handler is used when the field/method annotated by {@link Option} * is of this type. * @param handlerClass * This class must have the constructor that has the same signature as * {@link OptionHandler#OptionHandler(CmdLineParser, OptionDef, Setter)} * @throws NullPointerException if {@code valueType} or {@code handlerClass} is {@code null}. * @throws IllegalArgumentException if {@code handlerClass} is not a subtype of {@code OptionHandler}. * @deprecated You should use {@link OptionHandlerRegistry#registerHandler(java.lang.Class, java.lang.Class)} instead. */ public static void registerHandler( Class valueType, Class<? extends OptionHandler> handlerClass ) { checkNonNull(valueType, "valueType"); checkNonNull(handlerClass, "handlerClass"); OptionHandlerRegistry.getRegistry().registerHandler(valueType, handlerClass); }
/** * Creates an {@link OptionHandler} that handles the given {@link Option} annotation * and the {@link Setter} instance. */ protected OptionHandler createOptionHandler(OptionDef o, Setter setter) { checkNonNull(o, "OptionDef"); checkNonNull(setter, "Setter"); return OptionHandlerRegistry.getRegistry().createOptionHandler(this, o, setter); }
/** * Gets the option handler registry singleton instance. * @return a shared instance of the registry. */ public synchronized static OptionHandlerRegistry getRegistry() { if (instance == null) { instance = new OptionHandlerRegistry(); } return instance; }