Class CommandModel
java.lang.Object
io.github.projectunified.craftcommand.processor.model.CommandModel
Model representing a parsed command or subcommand class.
Nested subcommand models are indexed by their class element on construction, so the model of any class in the command tree is resolved by a direct lookup instead of a tree walk.
-
Constructor Summary
ConstructorsConstructorDescriptionCommandModel(com.palantir.javapoet.ClassName className, String packageName, String commandName, List<String> aliases, String description, MethodModel defaultMethod, List<MethodModel> subcommands, List<CommandModel> nestedSubcommands, TypeElement element) -
Method Summary
Modifier and TypeMethodDescriptionfindModel(TypeElement targetClass) Finds the model of a class within this command tree.Gets the aliases of the command.com.palantir.javapoet.ClassNameGets the ClassName of the command class.Gets the primary name of the command.Gets the default execution method.Gets the command description.Gets the underlying Java TypeElement of this class.Gets this model and every nested subcommand model indexed by their class element.Gets the nested class-level subcommands.Gets the package name of the command class.Gets the method-level subcommands.
-
Constructor Details
-
CommandModel
public CommandModel(com.palantir.javapoet.ClassName className, String packageName, String commandName, List<String> aliases, String description, MethodModel defaultMethod, List<MethodModel> subcommands, List<CommandModel> nestedSubcommands, TypeElement element)
-
-
Method Details
-
getClassName
public com.palantir.javapoet.ClassName getClassName()Gets the ClassName of the command class.- Returns:
- the class name
-
getPackageName
Gets the package name of the command class.- Returns:
- the package name
-
getCommandName
Gets the primary name of the command.- Returns:
- the command name
-
getAliases
Gets the aliases of the command.- Returns:
- the list of aliases
-
getDescription
Gets the command description.- Returns:
- the description
-
getDefaultMethod
Gets the default execution method.- Returns:
- the default method model, or
nullif none
-
getSubcommands
Gets the method-level subcommands.- Returns:
- the list of subcommands
-
getNestedSubcommands
Gets the nested class-level subcommands.- Returns:
- the list of nested subcommands
-
getElement
Gets the underlying Java TypeElement of this class.- Returns:
- the type element
-
getNestedIndex
Gets this model and every nested subcommand model indexed by their class element.- Returns:
- map of class element to command model
-
findModel
Finds the model of a class within this command tree.- Parameters:
targetClass- the class element to look up- Returns:
- the matching model, or
nullif the class is not part of this tree
-