E - The type of the executorT - The type of the argumentpublic abstract class ArgumentNode<E,T>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
providesArgument |
protected int |
weight |
| Constructor and Description |
|---|
ArgumentNode(java.lang.String name) |
ArgumentNode(java.lang.String name,
java.lang.String description) |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<ArgumentNode<E,?>> |
children() |
java.util.Set<java.lang.String> |
completions(CompletionContext completionContext,
ExecutionContext<E> executionContext,
StringReader reader)
Provide the completions of this argument.
|
CompletionsProvider<E> |
completionsProvider() |
java.lang.String |
description() |
CommandExceptionHandler<E> |
exceptionHandler() |
ArgumentNode<E,T> |
exceptionHandler(CommandExceptionHandler<E> exceptionHandler)
Set the exception handler of this argument node.
|
ArgumentNode<E,T> |
executes(java.util.function.Consumer<ExecutionContext<E>> consumer)
Set the
Consumer executor of this argument node. |
ArgumentNode<E,T> |
executes(java.util.function.Function<ExecutionContext<E>,?> function)
Set the
Function executor of this argument node. |
ArgumentNode<E,T> |
executes(java.lang.Runnable runnable)
Set the
Runnable executor of this argument node. |
ArgumentNode<E,T> |
executes(java.util.function.Supplier<?> supplier)
Set the
Supplier executor of this argument node. |
java.util.function.Function<ExecutionContext<E>,?> |
executor() |
java.lang.String |
name() |
protected abstract void |
parseCompletions(java.util.Set<java.lang.String> completions,
CompletionContext completionContext,
ExecutionContext<E> executionContext,
StringReader stringReader)
Provide the completions of this argument.
|
protected abstract T |
parseValue(ExecutionContext<E> executionContext,
StringReader stringReader)
Parse the value of this argument.
|
boolean |
providesArgument() |
ArgumentRequirement<E> |
requirement() |
ArgumentNode<E,T> |
requires(ArgumentRequirement<E> requirement)
Set the requirement of this argument node.
|
ArgumentNode<E,T> |
suggestions(CompletionsProvider<E> completionsProvider)
Set the custom completions provider of this argument node.
|
ArgumentNode<E,T> |
then(ArgumentNode<E,?> child)
Add a child to this argument node.
|
java.util.function.Predicate<T> |
validator() |
ArgumentNode<E,T> |
validator(java.util.function.Predicate<T> validator)
Set the validator of this argument node.
|
T |
value(ExecutionContext<E> executionContext,
StringReader stringReader)
Parse the value of this argument.
|
int |
weight() |
public ArgumentNode(java.lang.String name)
public ArgumentNode(java.lang.String name,
@Nullable
java.lang.String description)
public java.lang.String name()
@Nullable public java.lang.String description()
public java.util.List<ArgumentNode<E,?>> children()
public int weight()
public boolean providesArgument()
StringNode)@Nonnull public ArgumentRequirement<E> requirement()
@Nullable public java.util.function.Predicate<T> validator()
@Nullable public CompletionsProvider<E> completionsProvider()
@Nullable public CommandExceptionHandler<E> exceptionHandler()
@Nullable public java.util.function.Function<ExecutionContext<E>,?> executor()
@Nonnull public T value(ExecutionContext<E> executionContext, StringReader stringReader) throws ArgumentParseException, java.lang.RuntimeException
executionContext - The execution contextstringReader - The string readerArgumentParseException - If the value could not be parsedjava.lang.RuntimeException - If an unexpected error occurredpublic java.util.Set<java.lang.String> completions(CompletionContext completionContext, ExecutionContext<E> executionContext, StringReader reader)
completionContext - The completion contextexecutionContext - The execution contextreader - The string reader@Nonnull protected abstract T parseValue(ExecutionContext<E> executionContext, StringReader stringReader) throws ArgumentParseException, java.lang.RuntimeException
executionContext - The execution contextstringReader - The string readerArgumentParseException - If the value could not be parsedjava.lang.RuntimeException - If an unexpected error occurredprotected abstract void parseCompletions(java.util.Set<java.lang.String> completions,
CompletionContext completionContext,
ExecutionContext<E> executionContext,
StringReader stringReader)
completions - The completionscompletionContext - The completion contextexecutionContext - The execution contextstringReader - The string readerpublic ArgumentNode<E,T> then(ArgumentNode<E,?> child)
child - The childpublic ArgumentNode<E,T> requires(ArgumentRequirement<E> requirement)
requirement - The requirementpublic ArgumentNode<E,T> validator(@Nullable java.util.function.Predicate<T> validator)
validator - The validatorpublic ArgumentNode<E,T> suggestions(@Nullable CompletionsProvider<E> completionsProvider)
completionsProvider - The completions providerpublic ArgumentNode<E,T> exceptionHandler(@Nullable CommandExceptionHandler<E> exceptionHandler)
exceptionHandler - The exception handlerpublic ArgumentNode<E,T> executes(java.lang.Runnable runnable)
Runnable executor of this argument node.runnable - The runnablepublic ArgumentNode<E,T> executes(java.util.function.Consumer<ExecutionContext<E>> consumer)
Consumer executor of this argument node.consumer - The consumerpublic ArgumentNode<E,T> executes(java.util.function.Supplier<?> supplier)
Supplier executor of this argument node.supplier - The supplierpublic ArgumentNode<E,T> executes(java.util.function.Function<ExecutionContext<E>,?> function)
Function executor of this argument node.function - The function