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

x33g5p2x  于2022-01-15 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(64)

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

Argument.index介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

public int index() {
  return base.index()+bias;
}

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

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

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

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

代码示例来源:origin: hudson/hudson-2.x

public int index() {
  return base.index()+bias;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public int index() {
  return base.index()+bias;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

public int index() {
  return base.index()+bias;
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

public int index() {
  return base.index() + bias;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

public int index() {
  return base.index()+bias;
}

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

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

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

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

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

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

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

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

相关文章