All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.puremvc.java.interfaces.IController Maven / Gradle / Ivy

Go to download

PureMVC is a lightweight framework for creating applications based upon the classic Model-View-Controller design meta-pattern. This is the specific implementation for the Java language. It does not support modular programming since it uses Singletons as Core actors rather than the Multiton used in the MultiCore Version.

The newest version!
//
//  PureMVC Java Standard
//
//  Copyright(c) 2019 Saad Shams 
//  Your reuse is governed by the Creative Commons Attribution 3.0 License
//

package org.puremvc.java.interfaces;

import java.util.function.Supplier;

/**
 * 

The interface definition for a PureMVC Controller.

* *

In PureMVC, an IController implementor * follows the 'Command and Controller' strategy, and * assumes these responsibilities:

* *
    *
  • Remembering which ICommands * are intended to handle which INotifications.
  • *
  • Registering itself as an IObserver with * the View for each INotification * that it has an ICommand mapping for.
  • *
  • Creating a new instance of the proper ICommand * to handle a given INotification when notified by the View.
  • *
  • Calling the ICommand's execute * method, passing in the INotification.
  • *
* * @see org.puremvc.java.interfaces INotification * @see org.puremvc.java.interfaces ICommand */ public interface IController { /** *

Register a particular ICommand class as the handler * for a particular INotification.

* * @param notificationName the name of the INotification * @param commandSupplier the Supplier Function of the ICommand */ void registerCommand(String notificationName, Supplier commandSupplier); /** *

Execute the ICommand previously registered as the * handler for INotifications with the given notification name.

* * @param notification the INotification to execute the associated ICommand for */ void executeCommand(INotification notification); /** *

Remove a previously registered ICommand to INotification mapping.

* * @param notificationName the name of the INotification to remove the ICommand mapping for */ void removeCommand(String notificationName); /** *

Check if a Command is registered for a given Notification

* * @param notificationName notification name * @return whether a Command is currently registered for the given notificationName. */ boolean hasCommand(String notificationName); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy