/** * Helper method to print usage at the command line interface. */ private static void printUsage() { System.out.println("Usage: ColumnarToStarTreeConverter"); for (Field field : ColumnarToStarTreeConverter.class.getDeclaredFields()) { if (field.isAnnotationPresent(Option.class)) { Option option = field.getAnnotation(Option.class); System.out .println(String.format("\t%-15s: %s (required=%s)", option.name(), option.usage(), option.required())); } } }
/** * Helper method to print usage at the command line interface. */ private static void printUsage() { System.out.println("Usage: DictionaryTORawIndexConverter"); for (Field field : ColumnarToStarTreeConverter.class.getDeclaredFields()) { if (field.isAnnotationPresent(Option.class)) { Option option = field.getAnnotation(Option.class); System.out .println(String.format("\t%-15s: %s (required=%s)", option.name(), option.usage(), option.required())); } } }
public void printUsage() { System.out.println("Usage: " + this.getName()); for (Field f : this.getClass().getDeclaredFields()) { if (f.isAnnotationPresent(Option.class)) { Option option = f.getAnnotation(Option.class); System.out.println(String .format("\t%-25s %-30s: %s (required=%s)", option.name(), option.metaVar(), option.usage(), option.required())); } } }
public void onOption( OptionWithUsage optionWithUsage) { out.println("\t" + optionWithUsage.option.name() + ": " + required(optionWithUsage.option) + optionWithUsage.usage); }
public void onOption( OptionWithUsage optionWithUsage ) { out.println(" <tr>"); writeTag("td","args4j-option",optionWithUsage.option.name()); writeTag("td","args4j-usage",optionWithUsage.usage); out.println(" </tr>"); }
public void onOption( OptionWithUsage optionWithUsage ) { out.println(" <option>"); writeTag("name",optionWithUsage.option.name()); writeTag("usage",optionWithUsage.usage); out.println(" </option>"); }
/** * Programmatically defines an option (instead of reading it from annotations as normal). * * @param setter the setter for the type * @param o the {@code Option} * @throws NullPointerException if {@code setter} or {@code o} is {@code null}. * @throws IllegalAnnotationError if the option name or one of the aliases is already taken. */ public void addOption(Setter setter, Option o) { checkNonNull(setter, "Setter"); checkNonNull(o, "Option"); checkOptionNotInMap(o.name()); for (String alias : o.aliases()) { checkOptionNotInMap(alias); } options.add(createOptionHandler(new NamedOptionDef(o), setter)); }
/** * Programmatically defines an option (instead of reading it from annotations as normal). * * @param setter the setter for the type * @param o the {@code Option} * @throws NullPointerException if {@code setter} or {@code o} is {@code null}. * @throws IllegalAnnotationError if the option name or one of the aliases is already taken. */ public void addOption(Setter setter, Option o) { checkNonNull(setter, "Setter"); checkNonNull(o, "Option"); checkOptionNotInMap(o.name()); for (String alias : o.aliases()) { checkOptionNotInMap(alias); } options.add(createOptionHandler(new NamedOptionDef(o), setter)); }
public NamedOptionDef(Option o) { super(o.usage(),o.metaVar(),o.required(),o.help(),o.hidden(),o.handler(),false); this.name = o.name(); this.aliases = createZeroSizedArrayIfNull(o.aliases()); this.depends = createZeroSizedArrayIfNull(o.depends()); this.forbids = createZeroSizedArrayIfNull(o.forbids()); }
public NamedOptionDef(Option o) { super(o.usage(),o.metaVar(),o.required(),o.help(),o.hidden(),o.handler(),false); this.name = o.name(); this.aliases = createZeroSizedArrayIfNull(o.aliases()); this.depends = createZeroSizedArrayIfNull(o.depends()); this.forbids = createZeroSizedArrayIfNull(o.forbids()); }
public void onOption( OptionWithUsage optionWithUsage) { out.println("\t" + optionWithUsage.option.name() + ": " + required(optionWithUsage.option) + optionWithUsage.usage); }
public void onOption( OptionWithUsage optionWithUsage ) { out.println(" <tr>"); writeTag("td","args4j-option",optionWithUsage.option.name()); writeTag("td","args4j-usage",optionWithUsage.usage); out.println(" </tr>"); }
public void onOption( OptionWithUsage optionWithUsage ) { out.println(" <option>"); writeTag("name",optionWithUsage.option.name()); writeTag("usage",optionWithUsage.usage); out.println(" </option>"); }
private void printFieldValues(Class<?> clazz) { try { for (Field eachField : clazz.getDeclaredFields()) { eachField.setAccessible(true); if (eachField.getAnnotation(Option.class) != null) { Option option = eachField.getAnnotation(Option.class); LOG.debug("%tOption {} = {}", option.name(), eachField.get(this)); } if (eachField.getAnnotation(Argument.class) != null) { LOG.debug("%tArgument {}", eachField.get(this)); } } } catch (IllegalAccessException e) { Throwables.propagate(e); } }
private void printFieldValues(Class<?> clazz) { try { for (Field eachField : clazz.getDeclaredFields()) { eachField.setAccessible(true); if (eachField.getAnnotation(Option.class) != null) { Option option = eachField.getAnnotation(Option.class); LOG.debug("%tOption {} = {}", option.name(), eachField.get(this)); } if (eachField.getAnnotation(Argument.class) != null) { LOG.debug("%tArgument {}", eachField.get(this)); } } } catch (IllegalAccessException e) { Throwables.propagate(e); } }
/** * Programmatically defines an option (instead of reading it from annotations as normal). * * @param setter the setter for the type * @param o the {@code Option} * @throws NullPointerException if {@code setter} or {@code o} is {@code null}. * @throws IllegalAnnotationError if the option name or one of the aliases is already taken. */ public void addOption(Setter setter, Option o) { checkNonNull(setter, "Setter"); checkNonNull(o, "Option"); checkOptionNotInMap(o.name()); for (String alias : o.aliases()) { checkOptionNotInMap(alias); } options.add(createOptionHandler(new NamedOptionDef(o), setter)); }
public NamedOptionDef(Option o) { super(o.usage(),o.metaVar(),o.required(),o.help(),o.hidden(),o.handler(),false); this.name = o.name(); this.aliases = createZeroSizedArrayIfNull(o.aliases()); this.depends = createZeroSizedArrayIfNull(o.depends()); this.forbids = createZeroSizedArrayIfNull(o.forbids()); }
public NamedOptionDef(Option o) { super(o.usage(),o.metaVar(),o.required(),o.help(),o.hidden(),o.handler(),false); this.name = o.name(); this.aliases = createZeroSizedArrayIfNull(o.aliases()); this.depends = createZeroSizedArrayIfNull(o.depends()); this.forbids = createZeroSizedArrayIfNull(o.forbids()); }