net.kano.joscar.snac
Interface SnacCmdFactory

All Known Implementing Classes:
ClientAcctCmdFactory, ClientAuthCmdFactory, ClientBuddyCmdFactory, ClientChatCmdFactory, ClientConnCmdFactory, ClientIcbmCmdFactory, ClientIconCmdFactory, ClientInviteCmdFactory, ClientLocCmdFactory, ClientPopupCmdFactory, ClientRoomCmdFactory, ClientSearchCmdFactory, ClientSsiCmdFactory, ServerAcctCmdFactory, ServerAuthCmdFactory, ServerBuddyCmdFactory, ServerChatCmdFactory, ServerConnCmdFactory, ServerIcbmCmdFactory, ServerIconCmdFactory, ServerInviteCmdFactory, ServerLocCmdFactory, ServerPopupCmdFactory, ServerRoomCmdFactory, ServerSearchCmdFactory, ServerSsiCmdFactory, SnacErrorFactory

public interface SnacCmdFactory

Provides an interface for generating SnacCommands from SnacPackets.


Method Summary
 SnacCommand genSnacCommand(SnacPacket packet)
          Attempts to convert the given SNAC packet to a SnacCommand.
 CmdType[] getSupportedTypes()
          Returns a list of the SNAC command types this factory can possibly convert to SnacCommands.
 

Method Detail

getSupportedTypes

public CmdType[] getSupportedTypes()
Returns a list of the SNAC command types this factory can possibly convert to SnacCommands. Note that it is not required to be able to convert every SNAC packet that matches the types returned by this method; rather, this just provides a means of filtering out types that can definitely not be handled (by not including them in the returned list).

Also note that the command types contained in the list returned must be consistent between calls to this method; that is, an implementation cannot change the supported command type list after this factory has been created.

Returns:
a list of command types that can be passed to genSnacCommand

genSnacCommand

public SnacCommand genSnacCommand(SnacPacket packet)
Attempts to convert the given SNAC packet to a SnacCommand. This can return null if no appropriate SnacCommand can be created (for example, if the packet is in an invalid format).

Parameters:
packet - the packet to use for generation of a SnacCommand
Returns:
an appropriate SnacCommand for representing the given SnacPacket, or null if no such object can be created