Interface SafeSuggestions<S>

Type Parameters:
S - the type of the suggestions
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface SafeSuggestions<S>
This class represents safe suggestions. These are parameterized suggestions which can be converted into a string under a mapping function. SafeSuggestions instances are best created using the static methods as opposed to functionally.
  • Method Details

    • toSuggestions

      ArgumentSuggestions toSuggestions(Function<S,String> mapper)
      Convert this SafeSuggestions object into an ArgumentSuggestions by mapping the values with a string mapping function.
      Parameters:
      mapper - a function which maps an instance of SafeSuggestions to a string.
      Returns:
      an ArgumentSuggestions object resulting from this mapping.
    • empty

      static <T> SafeSuggestions<T> empty()
      Create an empty SafeSuggestions object.
      Type Parameters:
      T - type parameter of the SafeSuggestions object
      Returns:
      a SafeSuggestions object resulting in empty suggestions
    • suggest

      @SafeVarargs static <T> SafeSuggestions<T> suggest(T... suggestions)
      Hardcode values to suggest
      Type Parameters:
      T - type of the values
      Parameters:
      suggestions - hardcoded values
      Returns:
      a SafeSuggestions object suggesting the hardcoded suggestions
    • suggest

      static <T> SafeSuggestions<T> suggest(Function<SuggestionInfo,T[]> suggestions)
      Suggest values as the result of a function
      Type Parameters:
      T - type of the values
      Parameters:
      suggestions - function providing the values
      Returns:
      a SafeSuggestion object suggesting the result of the function
    • suggestAsync

      static <T> SafeSuggestions<T> suggestAsync(Function<SuggestionInfo,CompletableFuture<T[]>> suggestions)
      Suggest values provided asynchronously
      Type Parameters:
      T - type of the values
      Parameters:
      suggestions - function providing the values asynchronously
      Returns:
      a SafeSuggestion object suggestion the result of the asynchronous function
    • tooltips

      @SafeVarargs static <T> SafeSuggestions<T> tooltips(Tooltip<T>... suggestions)
      Suggest hardcoded values with tooltips
      Type Parameters:
      T - type of the values
      Parameters:
      suggestions - hardcoded values with their tooltips
      Returns:
      a SafeSuggestion object suggesting the hardcoded values
    • tooltips

      static <T> SafeSuggestions<T> tooltips(Function<SuggestionInfo,Tooltip<T>[]> suggestions)
      Suggest values with tooltips as the result of a function
      Type Parameters:
      T - type of the values
      Parameters:
      suggestions - function providing the values with tooltips
      Returns:
      a SafeSuggestion object suggesting the result of the function
    • tooltipsAsync

      static <T> SafeSuggestions<T> tooltipsAsync(Function<SuggestionInfo,CompletableFuture<Tooltip<T>[]>> suggestions)
      Suggest values with tooltips asynchronously
      Type Parameters:
      T - type of the values
      Parameters:
      suggestions - function providing the values with tooltips
      Returns:
      a SafeSuggestion suggesting the result of the asynchronous function