public abstract class AbstractParametricCommand extends Object implements CommandCallable
CommandCallable that does everything
but the actual parameter binding and method calling.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractParametricCommand(ParametricBuilder builder)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
call(Object[] args)
Called with parsed arguments.
|
boolean |
call(String stringArguments,
CommandLocals locals,
String[] parentCommands)
Execute the correct command based on the input.
|
com.google.common.collect.ImmutableSet<Annotation> |
getAnnotations()
Get the annotations that describe the command.
|
protected ParametricBuilder |
getBuilder()
Get the instance of the parametric builder.
|
protected boolean |
getIgnoreUnusedFlags()
Get whether unused flags should be ignored (and therefore not cause
an exception to be thrown).
|
protected List<? extends ParameterData<?>> |
getParameters()
Get the parameters that have been set.
|
protected List<String> |
getPermissions()
Get the parameters.
|
List<String> |
getSuggestions(String arguments,
CommandLocals locals)
Get a list of suggestions based on input.
|
protected Set<Character> |
getUnusedFlags()
Get the list of flags that can be unused when parsing arguments.
|
protected Set<Character> |
getValueFlags()
Get the value flags.
|
void |
setAnnotations(Set<Annotation> annotations)
Set the annotations that describe the command.
|
protected void |
setIgnoreUnusedFlags(boolean ignoreUnusedFlags)
Set whether unused flags should be ignored (and therefore not cause
an exception to be thrown).
|
protected void |
setParameters(List<? extends ParameterData<?>> parameters)
Set the parameters that have been set.
|
protected void |
setPermissions(List<String> permissions)
Set the list of permissions, one of which must be met.
|
protected void |
setUnusedFlags(Set<Character> unusedFlags)
Set the list of flags that can be unused when parsing arguments.
|
protected void |
setValueFlags(Set<Character> valueFlags) |
boolean |
testPermission(CommandLocals locals)
Test whether this command can be executed with the given context.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDescriptionprotected AbstractParametricCommand(ParametricBuilder builder)
builder - the builderprotected ParametricBuilder getBuilder()
protected List<? extends ParameterData<?>> getParameters()
protected void setParameters(List<? extends ParameterData<?>> parameters)
parameters - the parametersprotected void setPermissions(List<String> permissions)
permissions - the permissionsprotected Set<Character> getValueFlags()
protected boolean getIgnoreUnusedFlags()
protected void setIgnoreUnusedFlags(boolean ignoreUnusedFlags)
ignoreUnusedFlags - true if unused flags are to be ignoredprotected Set<Character> getUnusedFlags()
protected void setUnusedFlags(Set<Character> unusedFlags)
unusedFlags - list of flagspublic com.google.common.collect.ImmutableSet<Annotation> getAnnotations()
public void setAnnotations(Set<Annotation> annotations)
annotations - the annotationspublic final boolean call(String stringArguments, CommandLocals locals, String[] parentCommands) throws CommandException, AuthorizationException
CommandCallableThe implementing class must perform the necessary permission checks.
call in interface CommandCallablestringArguments - the argumentslocals - the localsparentCommands - a list of parent commands, with the first most entry being the top-level commandCommandException - thrown on a command errorAuthorizationExceptionprotected abstract void call(Object[] args) throws Exception
args - the parsed argumentsException - on any errorpublic boolean testPermission(CommandLocals locals)
CommandCallabletestPermission in interface CommandCallablelocals - the localspublic List<String> getSuggestions(String arguments, CommandLocals 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.