if (opt == null) throw new UnknownSuboptionException(curArg, curArg.charAt(i)); if (opt.wantsValue()) throw new NotFlagException(curArg, curArg.charAt(i)); addValue(opt, opt.getValue(null, locale)); if (opt.wantsValue()) { if (valueArg == null) { position += 1; value = opt.getValue(valueArg, locale); } else { value = opt.getValue(null, locale);
System.out.println(allOptions[j].longForm() + ": " + myOptions.getOptionValue(allOptions[j]));
if(opt==null) throw new UnknownSuboptionException(curArg,curArg.charAt(i)); if(opt.wantsValue()) throw new NotFlagException(curArg,curArg.charAt(i)); addValue(opt, opt.getValue(null,locale)); if ( opt.wantsValue() ) { if ( valueArg == null ) { position += 1; value = opt.getValue(valueArg, locale); value = opt.getValue(null, locale);
if(opt==null) throw new UnknownSuboptionException(curArg,curArg.charAt(i)); if(opt.wantsValue()) throw new NotFlagException(curArg,curArg.charAt(i)); addValue(opt, opt.getValue(null,locale)); if ( opt.wantsValue() ) { if ( valueArg == null ) { position += 1; value = opt.getValue(valueArg, locale); value = opt.getValue(null, locale);
if(opt==null) throw new UnknownSuboptionException(curArg,curArg.charAt(i)); if(opt.wantsValue()) throw new NotFlagException(curArg,curArg.charAt(i)); addValue(opt, opt.getValue(null,locale)); if ( opt.wantsValue() ) { if ( valueArg == null ) { position += 1; value = opt.getValue(valueArg, locale); value = opt.getValue(null, locale);
if(opt==null) throw new UnknownSuboptionException(curArg,curArg.charAt(i)); if(opt.wantsValue()) throw new NotFlagException(curArg,curArg.charAt(i)); addValue(opt, opt.getValue(null,locale)); if ( opt.wantsValue() ) { if ( valueArg == null ) { position += 1; value = opt.getValue(valueArg, locale); value = opt.getValue(null, locale);
/** * Gets the option value. * * @param o * the o * @param def * the def * @return the parsed value of the given Option, or the given default 'def' if the option was not set */ @SuppressWarnings("unchecked") public final Object getOptionValue(Option o, Object def) { List<String> v = (ArrayList<String>) values.get(o.longForm()); if (v == null) { return def; } else if (v.isEmpty()) { return null; } else { Object result = v.get(0); v.remove(0); return result; } }
/** * Gets the value. * * @param arg * the arg * @param locale * the locale * @return the value * @throws IllegalOptionValueException * the illegal option value exception */ public final Object getValue(String arg, Locale locale) throws IllegalOptionValueException { if (this.wantsValue) { if (arg == null) { throw new IllegalOptionValueException(this, ""); } return this.parseValue(arg, locale); } else { return Boolean.TRUE; } }
/** * @return the parsed value of the given Option, or null if the * option was not set */ public final Object getOptionValue( Option o, Object def ) { Vector v = (Vector)values.get(o.longForm()); if (v == null) { return def; } else if (v.isEmpty()) { return null; } else { Object result = v.elementAt(0); v.removeElementAt(0); return result; } }
/** * @return the parsed value of the given Option, or null if the * option was not set */ public final Object getOptionValue( Option o, Object def ) { Vector v = (Vector)values.get(o.longForm()); if (v == null) { return def; } else if (v.isEmpty()) { return null; } else { Object result = v.elementAt(0); v.removeElementAt(0); return result; } }
/** * Adds the value. * * @param opt * the opt * @param value * the value */ @SuppressWarnings("unchecked") private void addValue(Option opt, Object value) { String lf = opt.longForm(); List<Object> v = (ArrayList<Object>) values.get(lf); if (v == null) { v = new ArrayList<>(); values.put(lf, v); } v.add(value); }
/** * @return the parsed value of the given Option, or null if the * option was not set */ public final Object getOptionValue( Option o, Object def ) { Vector v = (Vector)values.get(o.longForm()); if (v == null) { return def; } else if (v.isEmpty()) { return null; } else { Object result = v.elementAt(0); v.removeElementAt(0); return result; } }
/** * @return the parsed value of the given Option, or the given default 'def' * if the option was not set */ public final Object getOptionValue( Option o, Object def ) { Vector v = (Vector)values.get(o.longForm()); if (v == null) { return def; } else if (v.isEmpty()) { return null; } else { Object result = v.elementAt(0); v.removeElementAt(0); return result; } }
/** * Instantiates a new illegal option value exception. * * @param opt * the opt * @param value * the value */ public IllegalOptionValueException(Option opt, String value) { super("Illegal value '" + value + "' for option " + (opt.shortForm() != null ? "-" + opt.shortForm() + "/" : "") + "--" + opt.longForm()); this.option = opt; this.value = value; }
private void addValue(Option opt, Object value) { String lf = opt.longForm(); Vector v = (Vector)values.get(lf); if (v == null) { v = new Vector(); values.put(lf, v); } v.addElement(value); }
private void addValue(Option opt, Object value) { String lf = opt.longForm(); Vector v = (Vector)values.get(lf); if (v == null) { v = new Vector(); values.put(lf, v); } v.addElement(value); }
public final Object getValue( String arg, Locale locale ) throws IllegalOptionValueException { if ( this.wantsValue ) { if ( arg == null ) { throw new IllegalOptionValueException(this, ""); } return this.parseValue(arg, locale); } else { return Boolean.TRUE; } }