Interface CompletionResult

All Superinterfaces:
MetaCarrier

public interface CompletionResult extends MetaCarrier
The result of a completion request, listing the possible completion values for a variable.
  • Method Details

    • values

      List<String> values()
      Returns the list of suggestions (max 100).
      Returns:
      the list of suggestions
    • total

      OptionalInt total()
      Returns the total number of suggestions available, if known.

      This may exceed the size of values().

      Returns:
      the total number of suggestions available, or an empty optional if not known
    • hasMore

      Optional<Boolean> hasMore()
      Returns whether or not there are more suggestions than are included in values(), if known.
      Returns:
      An Optional containing true if there are more suggestions, false if there are not, or an empty Optional if it is not known
    • builder

      static CompletionResult.Builder builder()
      Create a new builder for a CompletionResult.
      Returns:
      the new CompletionResult builder
    • newCompleteResult

      static CompletionResult newCompleteResult(List<String> values)
      Creates a new CompletionResult with a list of suggestions that is the complete set of available suggestions.
      Parameters:
      values - the list of suggestions
      Returns:
      the new completion result
    • newIncompleteResult

      static CompletionResult newIncompleteResult(List<String> values)
      Creates a new CompletionResult with a list of suggestions that is not the complete set of available suggestions.
      Parameters:
      values - the list of suggestions
      Returns:
      the new completion result
    • newResult

      static CompletionResult newResult(List<String> values, int total)
      Creates a new CompletionResult which includes a list of suggestions and the total number of available suggestions.
      Parameters:
      values - the list of suggestions
      total - the total number of available suggestions
      Returns:
      the new completion result
      Throws:
      IllegalArgumentException - if total is less than values.size()