org.puremvc.java.interfaces.IFacade Maven / Gradle / Ivy
Show all versions of PureMVC Show documentation
//
// 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 Facade.
*
* The Facade Pattern suggests providing a single
* class to act as a central point of communication
* for a subsystem.
*
* In PureMVC, the Facade acts as an interface between
* the core MVC actors (Model, View, Controller) and
* the rest of your application.
*
* @see IModel IModel
* @see IView IView
* @see org.puremvc.java.interfaces.IController IController
* @see org.puremvc.java.interfaces.ICommand ICommand
* @see org.puremvc.java.interfaces.INotification INotification
*/
public interface IFacade extends INotifier {
/**
* Register an IProxy
with the Model
by name.
*
* @param proxy the IProxy
to be registered with the Model
.
*/
void registerProxy(IProxy proxy);
/**
* Retrieve a IProxy
from the Model
by name.
*
* @param proxyName the name of the IProxy
instance to be retrieved.
* @return the IProxy
previously regisetered by proxyName
with the Model
.
*/
IProxy retrieveProxy(String proxyName);
/**
* Remove an IProxy
instance from the Model
by name.
*
* @param proxyName the IProxy
to remove from the Model
.
* @return the IProxy
that was removed from the Model
*/
IProxy removeProxy(String proxyName);
/**
* Check if a Proxy is registered
*
* @param proxyName proxy name
* @return whether a Proxy is currently registered with the given proxyName
.
*/
boolean hasProxy(String proxyName);
/**
* Register an ICommand
with the Controller
.
*
* @param notificationName the name of the INotification
to associate the ICommand
with.
* @param commandSupplier a reference to the Command Supplier Function of the ICommand
.
*/
void registerCommand(String notificationName, Supplier commandSupplier);
/**
* Remove a previously registered ICommand
to INotification
mapping from the Controller.
*
* @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);
/**
* Register an IMediator
instance with the View
.
*
* @param mediator a reference to the IMediator
instance
*/
void registerMediator(IMediator mediator);
/**
* Retrieve an IMediator
instance from the View
.
*
* @param mediatorName the name of the IMediator
instance to retrievve
* @return the IMediator
previously registered with the given mediatorName
.
*/
IMediator retrieveMediator(String mediatorName);
/**
* Remove a IMediator
instance from the View
.
*
* @param mediatorName name of the IMediator
instance to be removed.
* @return the IMediator
instance previously registered with the given mediatorName
.
*/
IMediator removeMediator(String mediatorName);
/**
* Check if a Mediator is registered or not
*
* @param mediatorName mediator name
* @return whether a Mediator is registered with the given mediatorName
.
*/
boolean hasMediator(String mediatorName);
/**
* Notify the IObservers
for a particular INotification
.
*
* All previously attached IObservers
for this INotification
's
* list are notified and are passed a reference to the INotification
in
* the order in which they were registered.
*
* NOTE: Use this method only if you are sending custom Notifications. Otherwise
* use the sendNotification method which does not require you to create the
* Notification instance.
*
* @param notification the INotification
to notify IObservers
of.
*/
void notifyObservers(INotification notification);
}