Java 类org.kohsuke.args4j.Localizable 实例源码

项目:chordelia    文件:KombinationsberechnungParameterJaNeinOptionHandler.java   
@Override
public int parseArguments(Parameters params) throws CmdLineException {
  log.info("Parsing: " + params);
  // Different compared to BooleanOptionHandler
  if (!option.isArgument()) {
    String valueStr = params.getParameter(0).toLowerCase();
    int index = ACCEPTABLE_VALUES.indexOf(valueStr);
    if (index == -1) {
      // TODO Check
      Localizable localizable = null;
      throw new CmdLineException(theParser, localizable, Messages.ILLEGAL_BOOLEAN.format(valueStr));
    }
    setter.addValue(index < ACCEPTABLE_VALUES.size() / 2);
    return 1;
  } else {
    setter.addValue(true);
    return 0;
  }
}