org.kohsuke.args4j.Option.usage()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中org.kohsuke.args4j.Option.usage()方法的一些代码示例,展示了Option.usage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option.usage()方法的具体详情如下:
包路径:org.kohsuke.args4j.Option
类名称:Option
方法名:usage

Option.usage介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-pinot

/**
 * 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()));
  }
 }
}

代码示例来源:origin: apache/incubator-pinot

/**
 * 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()));
  }
 }
}

代码示例来源:origin: apache/incubator-pinot

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()));
  }
 }
}

代码示例来源:origin: kohsuke/args4j

private String getUsage(Option o) {
  if(resource==null)
    return o.usage();
  else
    return resource.getProperty(o.usage());
}

代码示例来源:origin: args4j/args4j

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());
}

代码示例来源:origin: args4j/args4j-tools

private String getUsage(Option o) {
  if(resource==null)
    return o.usage();
  else
    return resource.getProperty(o.usage());
}

代码示例来源:origin: kohsuke/args4j

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());
}

代码示例来源:origin: zanata/zanata-platform

private static <T> String getUsageFromOptionAnnotation(
    Class<? extends BasicOptions> optionsClass, String methodName,
    Class<T> argType) {
  try {
    return optionsClass
        .getMethod(methodName, argType).getAnnotation(
            Option.class).usage()
        // the usage text is not very well formatted (contains new line)
        .replaceAll(System.getProperty("line.separator"), " ");
  } catch (NoSuchMethodException e) {
    log.error("can not find method: {} on class {}", methodName, optionsClass);
    return methodName;
  }
}

代码示例来源:origin: org.zanata/zanata-client-commands

private static <T> String getUsageFromOptionAnnotation(
    Class<? extends BasicOptions> optionsClass, String methodName,
    Class<T> argType) {
  try {
    return optionsClass
        .getMethod(methodName, argType).getAnnotation(
            Option.class).usage()
        // the usage text is not very well formatted (contains new line)
        .replaceAll(System.getProperty("line.separator"), " ");
  } catch (NoSuchMethodException e) {
    log.error("can not find method: {} on class {}", methodName, optionsClass);
    return methodName;
  }
}

代码示例来源:origin: org.opennms.features/jmxconfiggenerator.webui

/**
   * In class {@link org.opennms.tools.jmxconfiggenerator.Starter} are several
   * command line options defined. Each option has a name (mandatory) and a
   * description (optional). This method gets all descriptions and assign each
   * description to the name. If the option starts with at least one '-' all
   * '-' are removed. Therefore the builded map looks like:
   * 
   * <pre>
   *      {key} -> {value}
   *      "force" -> "this option forces the deletion of the file"
   * </pre>
   * 
   * @return a Map containing a description for each option defined in
   *         {@link org.opennms.tools.jmxconfiggenerator.Starter}
   * @see org.opennms.tools.jmxconfiggenerator.Starter
   */
  private Map<String, String> getOptionDescriptions() {
    Map<String, String> optionDescriptions = new HashMap<String, String>();
    for (java.lang.reflect.Field f : Starter.class.getDeclaredFields()) {
      Option ann = f.getAnnotation(Option.class);
      if (ann == null || ann.usage() == null) {
        continue;
      }
      optionDescriptions.put(ann.name().replaceAll("-", ""), ann.usage());
    }
    return optionDescriptions;
  }
}

代码示例来源:origin: org.zenframework.z8.dependencies.minimizers/closure

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());
}

代码示例来源:origin: Nextdoor/bender

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());
}

相关文章