Package org.jivesoftware.smackx.commands
Interface AdHocCommandHandlerFactory
public interface AdHocCommandHandlerFactory
A factory for creating ad-hoc command handlers. It's useful in cases where instantiation
of a command is more complicated than just using the default constructor. For example,
when arguments must be passed into the constructor or when using a dependency injection
framework. When a factory isn't used, you can provide the AdHocCommandManager
a Class object instead. For more details, see
AdHocCommandManager.registerCommand(String, String, AdHocCommandHandlerFactory)
.-
Method Summary
Modifier and TypeMethodDescriptionReturns a new instance of an ad-hoc command handler.
-
Method Details
-
create
AdHocCommandHandler create(String node, String name, String sessionId) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException Returns a new instance of an ad-hoc command handler.- Parameters:
node
- the node of the ad-hoc command.name
- the name of the ad-hoc command.sessionId
- the session ID of the ad-hoc command.- Returns:
- a LocalCommand instance.
- Throws:
InstantiationException
- if creating an instance failed.IllegalAccessException
- if creating an instance is not allowed.InvocationTargetException
- if a reflection-based method or constructor invocation threw.IllegalArgumentException
- if an illegal argument was given.
-