Field unmatchedField = null;
for (Field f : argumentHolder.getFields()) {
if (Modifier.isStatic(f.getModifiers())) {
continue;
}
Positional pos = f.getAnnotation(Positional.class);
if (f.getAnnotation(Unmatched.class) != null) {
YarrgConfigurationException.unless(f.getType().equals(List.class),
"'" + f + "' is @Unmatched but not a List");
YarrgConfigurationException.unless(unmatchedField == null,
"'" + f + "' and '" + unmatchedField + "' both have @Unmatched");
unmatchedField = f;
} else if (f.getType().equals(Boolean.TYPE)) {
addOption(new FlagOptionArgument(f));
continue;
}
YarrgConfigurationException.unless(factory.handles(f), "Unhandled type: " + f);
if (pos != null) {
Map<Integer, PositionalArgument> positionals =
pos.value() < 0 ? negaPositionals : posiPositionals;
PositionalArgument existent =
positionals.put(pos.value(), new PositionalArgument(f));
if (existent != null) {
throw new YarrgConfigurationException("Attempted to assign '" + f
+ "' to the same position as '" + existent.field + "'");
}
} else {