Java Code Examples for org.kohsuke.args4j.spi.Parameters#size()
The following examples show how to use
org.kohsuke.args4j.spi.Parameters#size() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EnumArrayOptionHandler.java From incubator-pinot with Apache License 2.0 | 6 votes |
/** * Tries to parse {@code String[]} argument from {@link Parameters}. */ @Override public int parseArguments(Parameters params) throws CmdLineException { int counter = 0; for (; counter < params.size(); counter++) { String param = params.getParameter(counter); if (param.startsWith("-")) { break; } for (String p : param.split(" ")) { Class<T> t = (Class<T>) setter.getType(); setter.addValue(Enum.valueOf(t, p)); } } return counter; }
Example 2
Source File: StringSetOptionHandler.java From buck with Apache License 2.0 | 6 votes |
@Override public int parseArguments(Parameters params) throws CmdLineException { int counter = 0; boolean hasValues = false; while (counter < params.size()) { String param = params.getParameter(counter); if (!param.isEmpty() && param.charAt(0) == '-') { break; } hasValues = true; builder.add(param); counter++; } Preconditions.checkArgument(hasValues, "Option \"%s\" takes one or more operands", option); return counter; }
Example 3
Source File: QueryMultiSetOptionHandler.java From buck with Apache License 2.0 | 6 votes |
/** Tries to parse {@code String[]} argument from {@link Parameters}. */ @Override public int parseArguments(Parameters params) throws CmdLineException { int counter = 0; for (; counter < params.size(); counter++) { String param = params.getParameter(counter); // Special case the -- separator if (param.startsWith("-") && !param.equals(QueryNormalizer.SET_SEPARATOR)) { break; } setter.addValue(param); } return counter; }
Example 4
Source File: Options.java From clutz with MIT License | 5 votes |
@Override public int parseArguments(Parameters params) throws CmdLineException { final int paramsSize = params.size(); for (int i = 0; i < paramsSize; i++) { String param = params.getParameter(i); if (param.startsWith("-")) { return i; } setter.addValue(param); } return paramsSize; }
Example 5
Source File: TestLabelOptions.java From buck with Apache License 2.0 | 5 votes |
@Override public int parseArguments(Parameters parameters) throws CmdLineException { int index; for (index = 0; index < parameters.size(); index++) { String parameter = parameters.getParameter(index); if (parameter.charAt(0) == '-') { break; } labels.put(ordinal.getAndIncrement(), LabelSelector.fromString(parameter)); } return index; }
Example 6
Source File: ConsumeAllOptionsHandler.java From buck with Apache License 2.0 | 5 votes |
@Override public int parseArguments(Parameters params) throws CmdLineException { for (int idx = 0; idx < params.size(); idx += 1) { setter.addValue(params.getParameter(idx)); } return params.size(); }