public final class CommandTreeNode
extends java.lang.Object
| Constructor and Description |
|---|
CommandTreeNode(@Nullable CommandTreeNode parent,
@NotNull java.lang.String label) |
| Modifier and Type | Method and Description |
|---|---|
@Nullable CommandTreeNode |
child(@NotNull java.lang.String label)
Gets a child node by label.
|
java.util.Map<java.lang.String,CommandTreeNode> |
children() |
@NotNull java.util.List<BladeCommand> |
collectCommands()
Traverses the tree and collects all commands.
|
@NotNull java.util.List<CommandTreeNode> |
collectNodes()
Traverses the tree and collects all nodes.
|
BladeCommand |
command() |
CommandTreeNode |
command(BladeCommand command) |
Container |
container() |
CommandTreeNode |
container(Container container) |
@Nullable BladeCommand |
findCommandByLabel(@NotNull java.lang.String fullLabel)
Finds a command by its full label.
|
@Nullable CommandTreeNode |
findNodeByLabel(@NotNull java.lang.String fullLabel)
Finds a command node by its full label.
|
boolean |
isBranch()
Checks if this node is a branch (has children).
|
boolean |
isLeaf()
Checks if this node is a leaf (has an associated command).
|
boolean |
isStub()
Checks if this node is a stub (has children and no command).
|
java.lang.String |
label() |
CommandTreeNode |
parent() |
public CommandTreeNode(@Nullable
@Nullable CommandTreeNode parent,
@NotNull
@NotNull java.lang.String label)
public boolean isLeaf()
public boolean isBranch()
public boolean isStub()
@Nullable public @Nullable CommandTreeNode child(@NotNull @NotNull java.lang.String label)
label - the child label@NotNull public @NotNull java.util.List<CommandTreeNode> collectNodes()
@Nullable public @Nullable CommandTreeNode findNodeByLabel(@NotNull @NotNull java.lang.String fullLabel)
fullLabel - the full command label@NotNull public @NotNull java.util.List<BladeCommand> collectCommands()
@Nullable public @Nullable BladeCommand findCommandByLabel(@NotNull @NotNull java.lang.String fullLabel)
fullLabel - the full command labelpublic CommandTreeNode parent()
public java.lang.String label()
public java.util.Map<java.lang.String,CommandTreeNode> children()
public BladeCommand command()
public Container container()
public CommandTreeNode command(BladeCommand command)
this.public CommandTreeNode container(Container container)
this.