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

org.puremvc.java.patterns.observer.Notifier 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.patterns.observer;

import org.puremvc.java.interfaces.IFacade;
import org.puremvc.java.interfaces.INotifier;
import org.puremvc.java.patterns.facade.Facade;

/**
 * 

A Base INotifier implementation.

* *

MacroCommand, Command, Mediator and Proxy all * have a need to send Notifications.

* *

The INotifier interface provides a common method called * sendNotification that relieves implementation code of the * necessity to actually construct Notifications.

* *

The Notifier class, which all of the above mentioned classes * extend, provides an initialized reference to the Facade * Singleton, which is required for the convienience method for sending * Notifications, but also eases implementation as these classes * have frequent Facade interactions and usually require access * to the facade anyway.

* * @see Facade Facade * @see org.puremvc.java.patterns.mediator.Mediator Mediator * @see org.puremvc.java.patterns.proxy.Proxy Proxy * @see org.puremvc.java.patterns.command.SimpleCommand SimpleCommand * @see org.puremvc.java.patterns.command.MacroCommand MacroCommand */ public class Notifier implements INotifier { /** *

Local reference to the Facade Singleton

*/ protected IFacade facade = Facade.getInstance(()-> new Facade()); /** *

Send an INotifications.

* *

Keeps us from having to construct new notification instances in our * implementation code.

* * @param notificationName the name of the notiification to send * @param body the body of the notification * @param type the type of the notification */ public void sendNotification(String notificationName, Object body, String type) { facade.sendNotification(notificationName, body, type); } /** *

Send an INotifications.

* *

Keeps us from having to construct new notification instances in our * implementation code.

* * @param notificationName the name of the notiification to send * @param body the body of the notification */ public void sendNotification(String notificationName, Object body) { facade.sendNotification(notificationName, body); } /** *

Send an INotifications.

* *

Keeps us from having to construct new notification instances in our * implementation code.

* * @param notificationName the name of the notiification to send */ public void sendNotification(String notificationName) { facade.sendNotification(notificationName); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy