public class ParametricBuilder extends Object
| Constructor and Description |
|---|
ParametricBuilder(Injector injector) |
| Modifier and Type | Method and Description |
|---|---|
void |
addExceptionConverter(ExceptionConverter converter)
Attach an exception converter to this builder in order to wrap unknown
Throwables into known CommandExceptions. |
void |
addInvokeListener(InvokeListener listener)
Attach an invocation listener.
|
Authorizer |
getAuthorizer()
Get the authorizer.
|
ExecutorService |
getCommandExecutor()
Get the executor service used to invoke the actual command.
|
CommandCompleter |
getDefaultCompleter()
Get the default command suggestions provider that will be used if
no suggestions are available.
|
Injector |
getInjector() |
void |
registerMethodsAsCommands(Dispatcher dispatcher,
Object object)
Build a list of commands from methods specially annotated with
Command
(and other relevant annotations) and register them all with the given
Dispatcher. |
void |
setAuthorizer(Authorizer authorizer)
Set the authorizer.
|
void |
setCommandExecutor(ExecutorService commandExecutor)
Set the executor service used to invoke the actual command.
|
void |
setDefaultCompleter(CommandCompleter defaultCompleter)
Set the default command suggestions provider that will be used if
no suggestions are available.
|
public ParametricBuilder(Injector injector)
public Injector getInjector()
public void addInvokeListener(InvokeListener listener)
Invocation handlers are called in order that their listeners are
registered with a ParametricBuilder. It is not guaranteed that
a listener may be called, in the case of a CommandException being
thrown at any time before the appropriate listener or handler is called.
listener - The listenertThe handlerpublic void addExceptionConverter(ExceptionConverter converter)
Throwables into known CommandExceptions.
Exception converters are called in order that they are registered.
converter - The converterfor an explanationpublic ExecutorService getCommandExecutor()
Bindings will still be resolved in the thread in which the callable was called.
public void setCommandExecutor(ExecutorService commandExecutor)
Bindings will still be resolved in the thread in which the callable was called.
public void registerMethodsAsCommands(Dispatcher dispatcher, Object object) throws ParametricException
Command
(and other relevant annotations) and register them all with the given
Dispatcher.dispatcher - The dispatcher to register commands withobject - The object contain the methodsParametricException - thrown if the commands cannot be registeredpublic Authorizer getAuthorizer()
public void setAuthorizer(Authorizer authorizer)
authorizer - The authorizerpublic CommandCompleter getDefaultCompleter()
public void setDefaultCompleter(CommandCompleter defaultCompleter)
defaultCompleter - The default command completerCopyright © 2015. All Rights Reserved.