Package net.orbyfied.j8.command
Class Node
java.lang.Object
net.orbyfied.j8.command.Node
Represents a command node in the
command tree. Has components that
determine what it is and can do.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe aliases of this node.The children (subnodes/subcommands) of this node.The children (subnodes/subcommands) of this node mapped by name.protected final ArrayList<NodeComponent>The components stored in a linear list.protected final HashMap<Class<?>,NodeComponent> The components mapped by class.NOTE: Only subcommands will be stored here, no parameters as they have nothing to be mapped to.protected final StringThe primary name of this node.protected final NodeThe immediate parent of this node.protected NodeThe root node of this tree. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAliases(String... aliases) <T extends NodeComponent>
TaddComponent(T component) <T extends NodeComponent>
NodeaddComponent(T component, Consumer<T> consumer) argument(ArgumentType<?> type) <T extends NodeComponent>
T<T extends NodeComponent>
Nodeexecutes(CommandNodeExecutor executor) executes(CommandNodeExecutor executor, CommandNodeExecutor walked) flag(String name, Character ch, ArgumentType<?> type, boolean isSwitch) flag(String name, ArgumentType<?> type) getChildByName(String name) getChildByPath(String... path) <T extends NodeComponent>
TgetComponent(Class<T> klass) <T> TgetComponentOf(Class<T> klass) Map<Class<?>,NodeComponent> getName()getNextSubnode(Context ctx, net.orbyfied.j8.util.StringReader reader) getOrCreateSubnode(String name, Function<Node, Node> constructor) getSubnode(String name) booleanhasComponentOf(Class<?> klass) <T extends NodeComponent>
TmakeComponent(Function<Node, T> constructor) <T extends NodeComponent>
NodemakeComponent(Function<Node, T> constructor, Consumer<T> consumer) parent()permission(String perm) voidprintTreeFancy(PrintStream stream) processExecute(Context context) processWalked(Context context, net.orbyfied.j8.util.StringReader reader) propertied(String desc, String label, String usage) removeAlias(String... aliases) removeChild(Node node) removeComponent(Class<?> klass) removeComponent(NodeComponent component) root()thenArgument(String name, ArgumentType<?> type) thenArgument(String name, ArgumentType<?> type, BiConsumer<Node, Argument> consumer) thenExecute(String name, CommandNodeExecutor executor) thenExecute(String name, CommandNodeExecutor executor, CommandNodeExecutor walked)
-
Field Details
-
components
The components stored in a linear list. -
componentsByClass
The components mapped by class. Includes all parent classes of a component which are not annotated withNonComponent -
children
The children (subnodes/subcommands) of this node. -
childrenByName
The children (subnodes/subcommands) of this node mapped by name. -
fastMappedChildren
NOTE: Only subcommands will be stored here, no parameters as they have nothing to be mapped to. -
name
The primary name of this node. -
aliases
The aliases of this node. -
parent
The immediate parent of this node. -
root
The root node of this tree.
-
-
Constructor Details
-
Node
Constructor.
-
-
Method Details
-
getChildren
-
getFastMappedChildren
-
getComponents
-
getComponentsByClass
-
parent
-
getName
-
getAliases
-
root
-
addAliases
-
removeAlias
-
makeComponent
-
makeComponent
public <T extends NodeComponent> Node makeComponent(Function<Node, T> constructor, Consumer<T> consumer) -
component
-
component
public <T extends NodeComponent> Node component(Class<T> tClass, Function<Node, T> constructor, BiConsumer<Node, T> consumer) -
addComponent
-
addComponent
-
removeComponent
-
removeComponent
-
getComponentOf
-
getComponent
-
hasComponentOf
-
addChild
-
addChild
-
removeChild
-
getChildByName
-
getChildByPath
-
getSubnode
-
getOrCreateSubnode
-
getNextSubnode
-
processWalked
-
processExecute
-
propertied
-
executes
-
executes
-
argument
-
permission
-
flag
-
flag
-
flag
-
thenArgument
-
thenArgument
-
thenExecute
-
thenExecute
-
printTreeFancy
-