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

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

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

Option.handler介绍

暂无

代码示例

代码示例来源: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: 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: openimaj/openimaj

private static List<Getter<?>> parse(Object bean) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
    ArrayList<Getter<?>> options = new ArrayList<Getter<?>>();
    // recursively process all the methods/fields.
    for (Class<?> c = bean.getClass(); c != null; c = c.getSuperclass()) {

      for (Field f : c.getDeclaredFields()) {
        Option o = f.getAnnotation(Option.class);
        if (o != null) {
          options.add(Getters.create(o.name(),f, bean));
          if (o.handler() == ProxyOptionHandler.class) {
            Field opField = c.getDeclaredField(f.getName() + "Op");
            Object opBean = null;
            try{
              opBean = opField.get(bean);                            
            }
            catch (Exception e) {
              opField.setAccessible(true);
              opBean = opField.get(bean);
              
            }
            options.addAll(parse(opBean));
          }
        }
      }
    }
    return options;
  }
}

代码示例来源:origin: org.openimaj/ImprovedArgs4J

private static List<Getter<?>> parse(Object bean) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
    ArrayList<Getter<?>> options = new ArrayList<Getter<?>>();
    // recursively process all the methods/fields.
    for (Class<?> c = bean.getClass(); c != null; c = c.getSuperclass()) {

      for (Field f : c.getDeclaredFields()) {
        Option o = f.getAnnotation(Option.class);
        if (o != null) {
          options.add(Getters.create(o.name(),f, bean));
          if (o.handler() == ProxyOptionHandler.class) {
            Field opField = c.getDeclaredField(f.getName() + "Op");
            Object opBean = null;
            try{
              opBean = opField.get(bean);                            
            }
            catch (Exception e) {
              opField.setAccessible(true);
              opBean = opField.get(bean);
              
            }
            options.addAll(parse(opBean));
          }
        }
      }
    }
    return options;
  }
}

代码示例来源: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());
}

代码示例来源: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());
}

相关文章