Class Completion
java.lang.Object
de.chojo.jdautil.util.Completion
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Enum<T>>
List<Command.Choice> Completes a enum.static <T extends Enum<T>>
List<Command.Choice> Completes a enumstatic List<Command.Choice> Complete an array of strings.static List<Command.Choice> complete(String value, Collection<String> inputs) Complete an collection of stringsstatic <T> List<Command.Choice> complete(String value, Collection<T> inputs, Function<T, String> mapping) Complete a collection of objectsstatic List<Command.Choice> Complete an stream of stringsstatic <T> List<Command.Choice> Complete an object stream.static <T> List<T> singleEntryList(T value)
-
Method Details
-
complete
Complete an array of strings.- Parameters:
value- current valueinputs- possible values- Returns:
- list of strings
-
complete
Complete an stream of strings- Parameters:
value- current valueinputs- possible values- Returns:
- list of strings
-
complete
Complete an collection of strings- Parameters:
value- current valueinputs- 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 valueinputs- possible valuesmapping- 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 valueinputs- possible valuesmapping- mapping of collection objects to string- Returns:
- list of strings
-
complete
Completes a enum. will return the enum values in lower case with underscores.- Type Parameters:
T- type of enum- Parameters:
value- current valueclazz- 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 valueclazz- enum clazzlowerCase- will make values lower case if truestrip- will strip underscores if true- Returns:
- list of strings
-
singleEntryList
-