Completer completer = null;
Field field = arguments.get(key);
if (field != null) {
Argument argument = field.getAnnotation(Argument.class);
multi = (argument != null && argument.multiValued());
Completion ann = field.getAnnotation(Completion.class);
if (ann != null) {
Class<?> clazz = ann.value();
String[] value = ann.values();
if (clazz != null) {
if (value.length > 0 && clazz == StringsCompleter.class) {
completer = new StringsCompleter(value, ann.caseSensitive());
} else {
completer = command.getCompleter(clazz);
}
}
} else {
completer = getDefaultCompleter(field, multi);
}
}
if (completer == null) {
completer = NullCompleter.INSTANCE;
}
argsCompleters.add(completer);
}
if (argsCompleters.isEmpty() || !multi) {
argsCompleters.add(NullCompleter.INSTANCE);
}
optionalCompleters = new HashMap<>();
for (Option option : fields.keySet()) {
Completer completer = null;
Field field = fields.get(option);
if (field != null) {
Completion ann = field.getAnnotation(Completion.class);
if (ann != null) {
Class clazz = ann.value();
String[] value = ann.values();
if (clazz != null) {
if (clazz == StringsCompleter.class) {
completer = new StringsCompleter(value, ann.caseSensitive());
} else {
completer = command.getCompleter(clazz);
}
}
} else {