Package org.puremvc.java.interfaces
Interface IController
- All Known Implementing Classes:
Controller
public interface IController
The interface definition for a PureMVC Controller.
In PureMVC, an IController
implementor
follows the 'Command and Controller' strategy, and
assumes these responsibilities:
- Remembering which
ICommand
s are intended to handle whichINotifications
. - Registering itself as an
IObserver
with theView
for eachINotification
that it has anICommand
mapping for. - Creating a new instance of the proper
ICommand
to handle a givenINotification
when notified by theView
. - Calling the
ICommand
'sexecute
method, passing in theINotification
.
- See Also:
INotification
,ICommand
-
Method Summary
Modifier and Type Method Description void
executeCommand(INotification notification)
Execute theICommand
previously registered as the handler forINotification
s with the given notification name.boolean
hasCommand(java.lang.String notificationName)
Check if a Command is registered for a given Notificationvoid
registerCommand(java.lang.String notificationName, java.util.function.Supplier<ICommand> commandSupplier)
Register a particularICommand
class as the handler for a particularINotification
.void
removeCommand(java.lang.String notificationName)
Remove a previously registeredICommand
toINotification
mapping.
-
Method Details
-
registerCommand
void registerCommand(java.lang.String notificationName, java.util.function.Supplier<ICommand> commandSupplier)Register a particular
ICommand
class as the handler for a particularINotification
.- Parameters:
notificationName
- the name of theINotification
commandSupplier
- the Supplier Function of theICommand
-
executeCommand
Execute the
ICommand
previously registered as the handler forINotification
s with the given notification name.- Parameters:
notification
- theINotification
to execute the associatedICommand
for
-
removeCommand
void removeCommand(java.lang.String notificationName)Remove a previously registered
ICommand
toINotification
mapping.- Parameters:
notificationName
- the name of theINotification
to remove theICommand
mapping for
-
hasCommand
boolean hasCommand(java.lang.String notificationName)Check if a Command is registered for a given Notification
- Parameters:
notificationName
- notification name- Returns:
- whether a Command is currently registered for the given
notificationName
.
-