@Override public int parseArguments(Parameters params) throws CmdLineException { if (option.isArgument()) { String valueStr = params.getParameter(0).toLowerCase(); int index = ACCEPTABLE_VALUES.indexOf(valueStr); if (index == -1) { throw new CmdLineException(owner, Messages.ILLEGAL_BOOLEAN, valueStr); } setter.addValue(index < ACCEPTABLE_VALUES.size() / 2); return 1; } else { setter.addValue(true); return 0; } }
@Override public int parseArguments(Parameters params) throws CmdLineException { if (option.isArgument()) { String valueStr = params.getParameter(0).toLowerCase(); int index = ACCEPTABLE_VALUES.indexOf(valueStr); if (index == -1) { throw new CmdLineException(owner, Messages.ILLEGAL_BOOLEAN, valueStr); } setter.addValue(index < ACCEPTABLE_VALUES.size() / 2); return 1; } else { setter.addValue(true); return 0; } }
/** * Get string representing usage for this option, of the form "name metaval" or "name=metaval, * e.g. "--foo VALUE" or "--foo=VALUE" * @param rb ResourceBundle to get localized version of meta string * @param properties * Affects the formatting behaviours. */ public final String getNameAndMeta(ResourceBundle rb, ParserProperties properties) { String str = option.isArgument() ? "" : option.toString(); String meta = getMetaVariable(rb); if (meta != null) { if (str.length() > 0) { str += properties.getOptionValueDelimiter(); } str += meta; } return str; }
/** * Get string representing usage for this option, of the form "name metaval" or "name=metaval, * e.g. "--foo VALUE" or "--foo=VALUE" * @param rb ResourceBundle to get localized version of meta string * @param properties * Affects the formatting behaviours. */ public final String getNameAndMeta(ResourceBundle rb, ParserProperties properties) { String str = option.isArgument() ? "" : option.toString(); String meta = getMetaVariable(rb); if (meta != null) { if (str.length() > 0) { str += properties.getOptionValueDelimiter(); } str += meta; } return str; }
@Override public int parseArguments(Parameters params) throws CmdLineException { String s = params.getParameter(0).replaceAll("-", "_"); T value = null; for( T o : enumType.getEnumConstants() ) if(o.name().equalsIgnoreCase(s)) { value = o; break; } if(value==null) { if (option.isArgument()) { throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, option.toString(), s); } else { throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, params.getParameter(-1),s); } } setter.addValue(value); return 1; }
@Override public int parseArguments(Parameters params) throws CmdLineException { String s = params.getParameter(0).replaceAll("-", "_"); T value = null; for( T o : enumType.getEnumConstants() ) if(o.name().equalsIgnoreCase(s)) { value = o; break; } if(value==null) { if (option.isArgument()) { throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, option.toString(), s); } else { throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, params.getParameter(-1),s); } } setter.addValue(value); return 1; }
@Override public int parseArguments(Parameters params) throws CmdLineException { if (option.isArgument()) { String valueStr = params.getParameter(0).toLowerCase(); int index = ACCEPTABLE_VALUES.indexOf(valueStr); if (index == -1) { throw new CmdLineException(owner, Messages.ILLEGAL_BOOLEAN, valueStr); } setter.addValue(index < ACCEPTABLE_VALUES.size() / 2); return 1; } else { setter.addValue(true); return 0; } }
@Override public int parseArguments(Parameters params) throws CmdLineException { if (option.isArgument()) { String valueStr = params.getParameter(0).toLowerCase(); int index = ACCEPTABLE_VALUES.indexOf(valueStr); if (index == -1) { throw new CmdLineException(owner, Messages.ILLEGAL_BOOLEAN, valueStr); } setter.addValue(index < ACCEPTABLE_VALUES.size() / 2); return 1; } else { setter.addValue(true); return 0; } }
/** * Get string representing usage for this option, of the form "name metaval" or "name=metaval, * e.g. "--foo VALUE" or "--foo=VALUE" * @param rb ResourceBundle to get localized version of meta string * @param properties * Affects the formatting behaviours. */ public final String getNameAndMeta(ResourceBundle rb, ParserProperties properties) { String str = option.isArgument() ? "" : option.toString(); String meta = getMetaVariable(rb); if (meta != null) { if (str.length() > 0) { str += properties.getOptionValueDelimiter(); } str += meta; } return str; }
/** * Get string representing usage for this option, of the form "name metaval" or "name=metaval, * e.g. "--foo VALUE" or "--foo=VALUE" * @param rb ResourceBundle to get localized version of meta string * @param properties * Affects the formatting behaviours. */ public final String getNameAndMeta(ResourceBundle rb, ParserProperties properties) { String str = option.isArgument() ? "" : option.toString(); String meta = getMetaVariable(rb); if (meta != null) { if (str.length() > 0) { str += properties.getOptionValueDelimiter(); } str += meta; } return str; }
@Override public int parseArguments(Parameters params) throws CmdLineException { String s = params.getParameter(0).replaceAll("-", "_"); T value = null; for( T o : enumType.getEnumConstants() ) if(o.name().equalsIgnoreCase(s)) { value = o; break; } if(value==null) { if (option.isArgument()) { throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, option.toString(), s); } else { throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, params.getParameter(-1),s); } } setter.addValue(value); return 1; }
@Override public int parseArguments(Parameters params) throws CmdLineException { String s = params.getParameter(0).replaceAll("-", "_"); T value = null; for( T o : enumType.getEnumConstants() ) if(o.name().equalsIgnoreCase(s)) { value = o; break; } if(value==null) { if (option.isArgument()) { throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, option.toString(), s); } else { throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, params.getParameter(-1),s); } } setter.addValue(value); return 1; }