E - The type of the executorpublic class LineBuilder<E>
extends java.lang.Object
ArgumentNode.| Modifier and Type | Method and Description |
|---|---|
<T> LineBuilder<E> |
arg(java.lang.String name,
ArgumentType<E,T> type)
Start building an argument and add it to the line.
|
<T> LineBuilder<E> |
arg(java.lang.String name,
java.lang.String description,
ArgumentType<E,T> type)
Start building an argument and add it to the line.
|
static <E> LineBuilder<E> |
create()
Create a new line builder.
|
<T> LineBuilder<E> |
defaultValue(T defaultValue)
Set the default value of the last added argument.
|
LineBuilder<E> |
exceptionHandler(CommandExceptionHandler<E> exceptionHandler)
Add an exception handler to the last added argument.
|
<R> ArgumentNode<E,R> |
executes(java.util.function.Consumer<ExecutionContext<E>> consumer)
Set the
Consumer executor of the line and build the line into an ArgumentNode. |
<R> ArgumentNode<E,R> |
executes(java.util.function.Function<ExecutionContext<E>,R> function)
Set the
Function executor of the line and build the line into an ArgumentNode. |
<R> ArgumentNode<E,R> |
executes(java.lang.Runnable runnable)
Set the
Runnable executor of the line and build the line into an ArgumentNode. |
<R> ArgumentNode<E,R> |
executes(java.util.function.Supplier<R> supplier)
Set the
Supplier executor of the line and build the line into an ArgumentNode. |
LineBuilder<E> |
suggestions(CompletionsProvider<E> completionsProvider)
Add a completions provider to the last added argument.
|
<T> LineBuilder<E> |
validator(java.util.function.Predicate<T> validator)
Add a validator to the last added argument.
|
public static <E> LineBuilder<E> create()
E - The type of the executorpublic <T> LineBuilder<E> arg(java.lang.String name, ArgumentType<E,T> type)
T - The type of the argumentname - The name of the argumenttype - The argument typepublic <T> LineBuilder<E> arg(java.lang.String name, @Nullable java.lang.String description, ArgumentType<E,T> type)
T - The type of the argumentname - The name of the argumentdescription - The description of the argumenttype - The argument typepublic <T> LineBuilder<E> validator(@Nullable java.util.function.Predicate<T> validator)
T - The type of the argumentvalidator - The validatorjava.lang.IllegalStateException - If no argument was added beforepublic LineBuilder<E> suggestions(@Nullable CompletionsProvider<E> completionsProvider)
completionsProvider - The completions providerjava.lang.IllegalStateException - If no argument was added beforepublic LineBuilder<E> exceptionHandler(@Nullable CommandExceptionHandler<E> exceptionHandler)
exceptionHandler - The exception handlerjava.lang.IllegalStateException - If no argument was added beforepublic <T> LineBuilder<E> defaultValue(@Nullable T defaultValue)
T - The type of the argumentdefaultValue - The default valuejava.lang.IllegalStateException - If no argument was added beforepublic <R> ArgumentNode<E,R> executes(java.lang.Runnable runnable)
Runnable executor of the line and build the line into an ArgumentNode.R - The return type of the executorrunnable - The executorArgumentNodepublic <R> ArgumentNode<E,R> executes(java.util.function.Consumer<ExecutionContext<E>> consumer)
Consumer executor of the line and build the line into an ArgumentNode.ExecutionContext as argument.R - The return type of the executorconsumer - The executorArgumentNodepublic <R> ArgumentNode<E,R> executes(java.util.function.Supplier<R> supplier)
Supplier executor of the line and build the line into an ArgumentNode.R - The return type of the executorsupplier - The executorArgumentNodepublic <R> ArgumentNode<E,R> executes(java.util.function.Function<ExecutionContext<E>,R> function)
Function executor of the line and build the line into an ArgumentNode.ExecutionContext as argument.R - The return type of the executorfunction - The executorArgumentNode