Class Completion

java.lang.Object
de.chojo.jdautil.util.Completion

public final class Completion extends Object
  • Method Details

    • complete

      public static List<Command.Choice> complete(String value, String... inputs)
      Complete an array of strings.
      Parameters:
      value - current value
      inputs - possible values
      Returns:
      list of strings
    • complete

      public static List<Command.Choice> complete(String value, Stream<String> inputs)
      Complete an stream of strings
      Parameters:
      value - current value
      inputs - possible values
      Returns:
      list of strings
    • complete

      public static List<Command.Choice> complete(String value, Collection<String> inputs)
      Complete an collection of strings
      Parameters:
      value - current value
      inputs - possible values
      Returns:
      list of strings
    • complete

      public static <T> List<Command.Choice> complete(String value, Stream<T> inputs, Function<T,String> mapping)
      Complete an object stream.
      Type Parameters:
      T - type of stream
      Parameters:
      value - current value
      inputs - possible values
      mapping - mapping of stream objects to string
      Returns:
      list of strings
    • complete

      public static <T> List<Command.Choice> complete(String value, Collection<T> inputs, Function<T,String> mapping)
      Complete a collection of objects
      Type Parameters:
      T - type of collection
      Parameters:
      value - current value
      inputs - possible values
      mapping - mapping of collection objects to string
      Returns:
      list of strings
    • complete

      public static <T extends Enum<T>> List<Command.Choice> complete(String value, Class<T> clazz)
      Completes a enum. will return the enum values in lower case with underscores.
      Type Parameters:
      T - type of enum
      Parameters:
      value - current value
      clazz - enum clazz
      Returns:
      list of strings
    • complete

      public static <T extends Enum<T>> List<Command.Choice> complete(String value, Class<T> clazz, boolean lowerCase, boolean strip)
      Completes a enum
      Type Parameters:
      T - type of enum
      Parameters:
      value - current value
      clazz - enum clazz
      lowerCase - will make values lower case if true
      strip - will strip underscores if true
      Returns:
      list of strings
    • singleEntryList

      public static <T> List<T> singleEntryList(T value)