use of org.apache.karaf.shell.console.completer.FileCompleter in project karaf by apache.
the class ArgumentCompleter method getDefaultCompleter.
private Completer getDefaultCompleter(Field field) {
Completer completer = null;
Class<?> type = field.getType();
if (type.isAssignableFrom(File.class)) {
completer = new FileCompleter(null);
} else if (type.isAssignableFrom(Boolean.class) || type.isAssignableFrom(boolean.class)) {
completer = new StringsCompleter(new String[] { "false", "true" }, false);
} else if (type.isAssignableFrom(Enum.class)) {
Set<String> values = new HashSet<>();
for (Object o : EnumSet.allOf((Class<Enum>) type)) {
values.add(o.toString());
}
completer = new StringsCompleter(values, false);
} else {
// TODO any other completers we can add?
}
return completer;
}
Aggregations