A - The actor typeT - The parameter type, for type-safety.public interface ParameterNode<A extends CommandActor,T> extends CommandNode<A>, RequiresPermission<A>, HasDescription
parameterType() that
can parse the content of MutableStringStream and generate the
appropriate values.
Note that this node will always correspond to a reflective Parameter through
the parameter() type.
| Modifier and Type | Method and Description |
|---|---|
@NotNull AnnotationList |
annotations()
Returns the annotations present on this
ParameterNode. |
@NotNull java.util.Collection<java.lang.String> |
complete(A actor,
@NotNull StringStream input,
@NotNull ExecutionContext<A> context)
Provides suggestions for the given user input.
|
@Nullable java.lang.String |
flagName()
Gets the flag name defined in
Flag.value(). |
default @NotNull java.lang.reflect.Type |
fullType()
Returns the parameter Java type
|
boolean |
isFlag()
Tests whether this parameter is a flag
|
boolean |
isGreedy()
Tests whether is this parameter greedy or not
|
default boolean |
isLiteral()
Tests whether this node is a
LiteralNode. |
boolean |
isOptional()
Tests whether is this parameter optional or not.
|
default boolean |
isParameter()
Tests whether this node is a
ParameterNode. |
default boolean |
isRequired()
Tests whether is this parameter required or not.
|
boolean |
isSwitch()
Tests whether this parameter is a switch
|
@NotNull CommandParameter |
parameter()
Returns the underlying
CommandParameter of this parameter
node |
@NotNull ParameterType<A,T> |
parameterType()
Returns the
ParameterType of this parameter that will be
used to parse the input. |
T |
parse(MutableStringStream input,
ExecutionContext<A> context)
Parses the given input and produces the appropriate value
for the input.
|
default @NotNull LiteralNode<A> |
requireLiteralNode()
Requires this node to be a
LiteralNode. |
@Nullable java.lang.Character |
shorthand()
Gets the shorthand defined from either
Flag.shorthand() or Switch.shorthand(). |
@NotNull SuggestionProvider<A> |
suggestions()
Returns the suggestion provider for this parameter node.
|
@Nullable java.lang.String |
switchName()
Gets the switch name defined in
Switch.value(). |
default @NotNull java.lang.Class<?> |
type()
Returns the parameter Java type
|
action, command, execute, hasAction, isLast, lamp, name, representation, requireParameterNodepermissiondescription@Nullable T parse(MutableStringStream input, ExecutionContext<A> context)
If this parameter was optional, or has a default value, it will be used if the input is not sufficient.
This may produce null values in case of isOptional() parameters
as well as ParameterTypes that may return a null value
input - The input typecontext - The execution context@NotNull @NotNull AnnotationList annotations()
ParameterNode.boolean isOptional()
This will return true in these cases:
default boolean isRequired()
This will return false in these cases:
@NotNull @NotNull ParameterType<A,T> parameterType()
ParameterType of this parameter that will be
used to parse the input.@NotNull @NotNull SuggestionProvider<A> suggestions()
factories
or have the default suggestions from ParameterType.defaultSuggestions().@NotNull @NotNull CommandParameter parameter()
CommandParameter of this parameter
nodeCommandParameter.boolean isGreedy()
@Contract(pure=true) @NotNull @NotNull java.util.Collection<java.lang.String> complete(A actor, @NotNull @NotNull StringStream input, @NotNull @NotNull ExecutionContext<A> context)
actor - The actor to generate forinput - The command inputcontext - The execution context.@NotNull default @NotNull java.lang.Class<?> type()
@NotNull default @NotNull java.lang.reflect.Type fullType()
default boolean isLiteral()
LiteralNode. This will
always return falseisLiteral in interface CommandNode<A extends CommandActor>default boolean isParameter()
ParameterNode. This
will always return trueisParameter in interface CommandNode<A extends CommandActor>@Contract(value="-> fail") @NotNull default @NotNull LiteralNode<A> requireLiteralNode()
LiteralNode. This will throw
a IllegalStateException.requireLiteralNode in interface CommandNode<A extends CommandActor>java.lang.IllegalStateException - alwaysboolean isFlag()
Flagboolean isSwitch()
Switch@Nullable @Contract(pure=true) @Nullable java.lang.Character shorthand()
Flag.shorthand() or Switch.shorthand().
This may return null if this parameter is neither a flag nor a switch.null if not defined.@Nullable @Contract(pure=true) @Nullable java.lang.String switchName()
Switch.value().
This may return null if this parameter is not a switch.null if not defined.@Nullable @Contract(pure=true) @Nullable java.lang.String flagName()
Flag.value().
This may return null if this parameter is not a flag.null if not defined.