Package org.incendo.cloud.syntax
Class StandardCommandSyntaxFormatter<C>
java.lang.Object
org.incendo.cloud.syntax.StandardCommandSyntaxFormatter<C>
- Type Parameters:
C- command sender type
- All Implemented Interfaces:
CommandSyntaxFormatter<C>
@API(status=INTERNAL,
consumers="org.incendo.cloud.*")
public class StandardCommandSyntaxFormatter<C>
extends Object
implements CommandSyntaxFormatter<C>
CommandSyntaxFormatter implementation that uses the following rules:
- static arguments are serialized as their name, without a bracket
- required arguments are serialized as their name, surrounded by angle brackets
- optional arguments are serialized as their name, surrounded by square brackets
- does not render arguments the sender does not have access to (either due to permission or sender type requirements)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInstance that is used when building command syntax -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
StandardCommandSyntaxFormatter
Creates a newStandardCommandSyntaxFormatter.- Parameters:
manager- command manager
-
-
Method Details
-
apply
public final @NonNull String apply(@Nullable C sender, @NonNull List<@NonNull CommandComponent<C>> commandComponents, @Nullable CommandNode<C> node) Format the command arguments into a syntax string- Specified by:
applyin interfaceCommandSyntaxFormatter<C>- Parameters:
sender- The sender to format syntax for.commandComponents- Command arguments that have been unambiguously specified up until this point. This should include the "current" command, if such a command exists.node- The current command node. The children of this node will be appended onto the command syntax string, as long as an unambiguous path can be identified. The node itself will not be appended onto the syntax string. This can be set tonullif no node is relevant at the point of formatting.- Returns:
- The formatted syntax string
-
createInstance
Create a new formatting instance- Returns:
- Formatting instance
-