public class CommandFactory
extends java.lang.Object
Constructor and Description |
---|
CommandFactory(ProtocolProviderServiceIrcImpl provider,
IrcConnection connection)
Constructor for instantiating a command factory.
|
Modifier and Type | Method and Description |
---|---|
Command |
createCommand(java.lang.String command)
Create new command based on the provided key if available in the command
registry.
|
static java.util.Map<java.lang.String,java.lang.Class<? extends Command>> |
getCommands()
Get an unmodifiable map of registered commands.
|
static void |
registerCommand(java.lang.String command,
java.lang.Class<? extends Command> type)
Register a new command at the factory.
|
static void |
unregisterCommand(java.lang.Class<? extends Command> type,
java.lang.String command)
Unregister a command from the factory.
|
CommandFactory(ProtocolProviderServiceIrcImpl provider, IrcConnection connection)
provider
- the protocol provider serviceconnection
- the IRC connectionpublic static java.util.Map<java.lang.String,java.lang.Class<? extends Command>> getCommands()
public static void registerCommand(java.lang.String command, java.lang.Class<? extends Command> type)
command
- the command wordtype
- the type to instantiate for command executionpublic static void unregisterCommand(java.lang.Class<? extends Command> type, java.lang.String command)
type
- the type to unregistercommand
- (optional) specify the command for which the type is
registered. This can be used to unregister only one of
multiple commands for the same implementation type.public Command createCommand(java.lang.String command) throws UnsupportedCommandException, BadCommandException
command
- the command to look up and instantiateUnsupportedCommandException
- in case command cannot be foundBadCommandException
- In case of a incompatible command or bad
implementation.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.