Search in sources :

Example 1 with Helper

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();
}
Also used : Helper(org.apache.geode.management.internal.cli.help.Helper) Completion(org.springframework.shell.core.Completion)

Aggregations

Helper (org.apache.geode.management.internal.cli.help.Helper)1 Completion (org.springframework.shell.core.Completion)1