public int index() { return base.index()+bias; }
/** * Programmatically defines an argument (instead of reading it from annotations as normal). * * @param setter the setter for the type * @param a the Argument * @throws NullPointerException if {@code setter} or {@code a} is {@code null}. */ public void addArgument(Setter setter, Argument a) { checkNonNull(setter, "Setter"); checkNonNull(a, "Argument"); OptionHandler h = createOptionHandler(new OptionDef(a,setter.isMultiValued()),setter); int index = a.index(); // make sure the argument will fit in the list while (index >= arguments.size()) { arguments.add(null); } if(arguments.get(index)!=null) { throw new IllegalAnnotationError(Messages.MULTIPLE_USE_OF_ARGUMENT.format(index)); } arguments.set(index, h); }
/** * Programmatically defines an argument (instead of reading it from annotations as normal). * * @param setter the setter for the type * @param a the Argument * @throws NullPointerException if {@code setter} or {@code a} is {@code null}. */ public void addArgument(Setter setter, Argument a) { checkNonNull(setter, "Setter"); checkNonNull(a, "Argument"); OptionHandler h = createOptionHandler(new OptionDef(a,setter.isMultiValued()),setter); int index = a.index(); // make sure the argument will fit in the list while (index >= arguments.size()) { arguments.add(null); } if(arguments.get(index)!=null) { throw new IllegalAnnotationError(Messages.MULTIPLE_USE_OF_ARGUMENT.format(index)); } arguments.set(index, h); }
public int index() { return base.index()+bias; }
public int index() { return base.index()+bias; }
public int index() { return base.index()+bias; }
public int index() { return base.index() + bias; }
public int index() { return base.index()+bias; }
private void removeArgument(CmdLineParser parser, Argument a) throws CmdLineException { try { Field argsField = CmdLineParser.class.getDeclaredField("arguments"); argsField.setAccessible(true); List<?> args = (List<?>) argsField.get(parser); OptionHandler<?> op = (OptionHandler<?>) args.get(a.index()); if (op.setter instanceof SetterWrapper && ((SetterWrapper)op.setter).used) { throw new CmdLineException(parser, "The use of the argument " + op.option.metaVar() + " is shaded by another argument"); } args.set(a.index(), null); } catch (CmdLineException e) { throw e; } catch (Exception e) { throw new CmdLineException(parser, "", e); } }
private void removeArgument(CmdLineParser parser, Argument a) throws CmdLineException { try { Field argsField = CmdLineParser.class.getDeclaredField("arguments"); argsField.setAccessible(true); List<?> args = (List<?>) argsField.get(parser); OptionHandler<?> op = (OptionHandler<?>) args.get(a.index()); if (op.setter instanceof SetterWrapper && ((SetterWrapper)op.setter).used) { throw new CmdLineException(parser, "The use of the argument " + op.option.metaVar() + " is shaded by another argument"); } args.set(a.index(), null); } catch (CmdLineException e) { throw e; } catch (Exception e) { throw new CmdLineException(parser, "", e); } }
/** * Programmatically defines an argument (instead of reading it from annotations as normal). * * @param setter the setter for the type * @param a the Argument * @throws NullPointerException if {@code setter} or {@code a} is {@code null}. */ public void addArgument(Setter setter, Argument a) { checkNonNull(setter, "Setter"); checkNonNull(a, "Argument"); OptionHandler h = createOptionHandler(new OptionDef(a,setter.isMultiValued()),setter); int index = a.index(); // make sure the argument will fit in the list while (index >= arguments.size()) { arguments.add(null); } if(arguments.get(index)!=null) { throw new IllegalAnnotationError(Messages.MULTIPLE_USE_OF_ARGUMENT.format(index)); } arguments.set(index, h); }
/** * Programmatically defines an argument (instead of reading it from annotations as normal). * * @param setter the setter for the type * @param a the Argument * @throws NullPointerException if {@code setter} or {@code a} is {@code null}. */ public void addArgument(Setter setter, Argument a) { checkNonNull(setter, "Setter"); checkNonNull(a, "Argument"); OptionHandler h = createOptionHandler(new OptionDef(a,setter.isMultiValued()),setter); int index = a.index(); // make sure the argument will fit in the list while (index >= arguments.size()) { arguments.add(null); } if(arguments.get(index)!=null) { throw new IllegalAnnotationError(Messages.MULTIPLE_USE_OF_ARGUMENT.format(index)); } arguments.set(index, h); }