public SubCommandHandler(CmdLineParser parser, OptionDef option, Setter<Object> setter) { super(parser, option, setter); commands = setter.asAnnotatedElement().getAnnotation(SubCommands.class); if (commands==null) throw new IllegalStateException("SubCommandHandler must be used with @SubCommands annotation"); }
public SubCommandHandler(CmdLineParser parser, OptionDef option, Setter<Object> setter) { super(parser, option, setter); commands = setter.asAnnotatedElement().getAnnotation(SubCommands.class); if (commands==null) throw new IllegalStateException("SubCommandHandler must be used with @SubCommands annotation"); }
@Override public AnnotatedElement asAnnotatedElement() { return proxy.asAnnotatedElement(); } }
@Override public AnnotatedElement asAnnotatedElement() { return proxy.asAnnotatedElement(); } }
public SubCommandHandler(CmdLineParser parser, OptionDef option, Setter<Object> setter) { super(parser, option, setter); commands = setter.asAnnotatedElement().getAnnotation(SubCommands.class); if (commands==null) throw new IllegalStateException("SubCommandHandler must be used with @SubCommands annotation"); }
@Override protected Integer parse(String argument) throws NumberFormatException, CmdLineException { int value = Integer.parseInt(argument); Range range = setter.asAnnotatedElement().getAnnotation(Range.class); if (range != null && value != Math.min(Math.max(value, range.min()), range.max())) { throw new NumberFormatException(); } return value; } }