com.ibm.portal.model.command
Interface CommandFactory

All Superinterfaces:
java.lang.Iterable<java.lang.Class<? extends Command>>, IterableListModel<java.lang.Class<? extends Command>>, ListModel<java.lang.Class<? extends Command>>

public interface CommandFactory
extends IterableListModel<java.lang.Class<? extends Command>>

Factory object used to create Command objects. Clients need to provide an implementation of the CommandContext to access a command. There exist default implementations of these contexts for the common case in the helper package. The IterableListModel allows to iterate over the Class objects of the supported commands.

Since:
8.0
See Also:
CommandFactoryHome
Note:
This interface is designed to be implemented by clients.

Method Summary
<T extends Command>
T
createCommand(CommandContext<T> ctx)
          Creates a new command in the given context.
 
Methods inherited from interface com.ibm.portal.IterableListModel
iterator
 

Method Detail

createCommand

<T extends Command> T createCommand(CommandContext<T> ctx)
                                throws ModelException
Creates a new command in the given context. The Command must be disposed via Disposable.dispose() when no longer used.

Type Parameters:
T - type of the command
Parameters:
ctx - the creation context
Returns:
the command, not null
Throws:
ModelException - if the command cannot be instantiated