use of org.apache.geode.management.internal.cli.help.Helper in project geode by apache.
the class HintTopicConverter method getAllPossibleValues.
@Override
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType, String existingData, String optionContext, MethodTarget target) {
Helper helper = commandManager.getHelper();
Set<String> topicNames = helper.getTopicNames();
for (String topicName : topicNames) {
if (existingData != null && !existingData.isEmpty()) {
if (topicName.startsWith(existingData)) {
// match exact case
completions.add(new Completion(topicName));
} else if (topicName.toLowerCase().startsWith(existingData.toLowerCase())) {
// match
// case
// insensitive
String completionStr = existingData + topicName.substring(existingData.length());
completions.add(new Completion(completionStr));
}
} else {
completions.add(new Completion(topicName));
}
}
return !completions.isEmpty();
}
Aggregations