Class StringsCompleter

java.lang.Object
org.openhab.core.io.console.StringsCompleter
All Implemented Interfaces:
ConsoleCommandCompleter

@NonNullByDefault public class StringsCompleter extends Object implements ConsoleCommandCompleter
Completer for a set of strings. It will provide candidate completions for whichever argument the cursor is located in.
Author:
Cody Cutrer - Initial contribution
  • Constructor Details

    • StringsCompleter

      public StringsCompleter()
    • StringsCompleter

      public StringsCompleter(Collection<String> strings, boolean caseSensitive)
      Parameters:
      strings - The set of valid strings to be completed
      caseSensitive - if strings must match case sensitively when the user is typing them
  • Method Details

    • getStrings

      public SortedSet<String> getStrings()
      Gets the strings that are allowed for this completer, so that you can modify the set.
    • complete

      public boolean complete(String[] args, int cursorArgumentIndex, int cursorPosition, List<String> candidates)
      Description copied from interface: ConsoleCommandCompleter
      Populate possible completion candidates.
      Specified by:
      complete in interface ConsoleCommandCompleter
      Parameters:
      args - An array of all arguments to be passed to the ConsoleCommandExtension's execute method
      cursorArgumentIndex - the argument index the cursor is currently in
      cursorPosition - the position of the cursor within the argument
      candidates - a list to fill with possible completion candidates
      Returns:
      if a candidate was found