Class Proxy

java.lang.Object
org.puremvc.java.patterns.observer.Notifier
org.puremvc.java.patterns.proxy.Proxy
All Implemented Interfaces:
INotifier, IProxy

public class Proxy
extends Notifier
implements IProxy

A base IProxy implementation.

In PureMVC, Proxy classes are used to manage parts of the application's data model.

A Proxy might simply manage a reference to a local data object, in which case interacting with it might involve setting and getting of its data in synchronous fashion.

Proxy classes are also used to encapsulate the application's interaction with remote services to save or retrieve data, in which case, we adopt an asyncronous idiom; setting data (or calling a method) on the Proxy and listening for a Notification to be sent when the Proxy has retrieved the data from the service.

See Also:
Model
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.lang.Object data  
    static java.lang.String NAME  
    protected java.lang.String proxyName  

    Fields inherited from class org.puremvc.java.patterns.observer.Notifier

    facade
  • Constructor Summary

    Constructors 
    Constructor Description
    Proxy()
    Constructor
    Proxy​(java.lang.String proxyName)
    Constructor
    Proxy​(java.lang.String proxyName, java.lang.Object data)
    Constructor
  • Method Summary

    Modifier and Type Method Description
    java.lang.Object getData()
    Get the data object
    java.lang.String getProxyName()
    Get the proxy name
    void onRegister()
    Called by the Model when the Proxy is registered
    void onRemove()
    Called by the Model when the Proxy is removed
    void setData​(java.lang.Object data)
    Set the data object

    Methods inherited from class org.puremvc.java.patterns.observer.Notifier

    sendNotification, sendNotification, sendNotification

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.puremvc.java.interfaces.INotifier

    sendNotification, sendNotification, sendNotification
  • Field Details

  • Constructor Details

    • Proxy

      public Proxy​(java.lang.String proxyName, java.lang.Object data)

      Constructor

      Parameters:
      proxyName - proxy name
      data - data object
    • Proxy

      public Proxy​(java.lang.String proxyName)

      Constructor

      Parameters:
      proxyName - Name of the Proxy
    • Proxy

      public Proxy()

      Constructor

  • Method Details

    • onRegister

      public void onRegister()

      Called by the Model when the Proxy is registered

      Specified by:
      onRegister in interface IProxy
    • onRemove

      public void onRemove()

      Called by the Model when the Proxy is removed

      Specified by:
      onRemove in interface IProxy
    • getProxyName

      public java.lang.String getProxyName()

      Get the proxy name

      Specified by:
      getProxyName in interface IProxy
      Returns:
      the proxy name
    • getData

      public java.lang.Object getData()

      Get the data object

      Specified by:
      getData in interface IProxy
      Returns:
      the data object
    • setData

      public void setData​(java.lang.Object data)

      Set the data object

      Specified by:
      setData in interface IProxy
      Parameters:
      data - data object