public abstract class AbstractParametricCallable extends Object implements CommandCallable
ArgumentParser.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractParametricCallable(ParametricBuilder builder,
ArgumentParser parser)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
call(Object[] args)
Called with parsed arguments to execute the command.
|
boolean |
call(String stringArguments,
Namespace namespace,
List<String> parentCommands)
Execute the command.
|
protected ParametricBuilder |
getBuilder()
Get the parametric builder.
|
protected List<? extends Annotation> |
getCommandAnnotations()
Get the annotations on the command.
|
protected ArgumentParser |
getParser()
Get the argument parser.
|
List<String> |
getSuggestions(String arguments,
Namespace locals)
Get a list of suggestions based on input.
|
protected Set<Character> |
getUnusedFlags()
Get a list of flags that should not cause an
UnusedArgumentException to be thrown if they are
not consumed by a parameter. |
protected boolean |
isIgnoreUnusedFlags()
Get whether flags that are not used by any parameter should be
ignored so that an
UnusedArgumentException is not
thrown. |
protected void |
setCommandAnnotations(List<? extends Annotation> commandAnnotations)
Set the annotations on the command.
|
protected void |
setIgnoreUnusedFlags(boolean ignoreUnusedFlags)
Set whether flags that are not used by any parameter should be
ignored so that an
UnusedArgumentException is not
thrown. |
protected void |
setUnusedFlags(Set<Character> unusedFlags)
Set a list of flags that should not cause an
UnusedArgumentException to be thrown if they are
not consumed by a parameter. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDescription, testPermissionprotected AbstractParametricCallable(ParametricBuilder builder, ArgumentParser parser)
builder - An instance of the parametric builderparser - The argument parserprotected ParametricBuilder getBuilder()
protected ArgumentParser getParser()
protected List<? extends Annotation> getCommandAnnotations()
protected void setCommandAnnotations(List<? extends Annotation> commandAnnotations)
commandAnnotations - The annotations on the commandprotected boolean isIgnoreUnusedFlags()
UnusedArgumentException is not
thrown.protected void setIgnoreUnusedFlags(boolean ignoreUnusedFlags)
UnusedArgumentException is not
thrown.ignoreUnusedFlags - Whether unused flags should be ignoredprotected Set<Character> getUnusedFlags()
UnusedArgumentException to be thrown if they are
not consumed by a parameter.protected void setUnusedFlags(Set<Character> unusedFlags)
UnusedArgumentException to be thrown if they are
not consumed by a parameter.unusedFlags - List of flags that can be unconsumedpublic final boolean call(String stringArguments, Namespace namespace, List<String> parentCommands) throws CommandException, InvocationCommandException, AuthorizationException
CommandCallableparentCommands is a list of "parent" commands, including
the current command, where each deeper command is appended to
the list of parent commands.
For example, if the command entered was /world create ocean and
the command in question was the "create" command, then:
arguments would be oceanparentCommands would be world createOn the other hand, if the command was "world," then:
arguments would be create oceanparentCommands would be worldcall in interface CommandCallablestringArguments - The argumentsnamespace - Additional values used for executionparentCommands - The list of parent commandsCommandException - If there is an error with the commandInvocationCommandException - If there is an error with executing the commandAuthorizationException - If there is a authorization errorprotected abstract void call(Object[] args) throws CommandException, InvocationCommandException
args - The arguments parsed into the appropriate Java objectsCommandException - Thrown on a command errorInvocationCommandException - Thrown on an error executing the commandpublic List<String> getSuggestions(String arguments, Namespace locals) throws CommandException
CommandCompletergetSuggestions in interface CommandCompleterarguments - the arguments entered up to this pointlocals - the localsCommandException - thrown if there was a parsing errorCopyright © 2015. All Rights Reserved.