org.puremvc.java.patterns.proxy
Class Proxy

java.lang.Object
  extended by org.puremvc.java.patterns.observer.Notifier
      extended by 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 inherited from class org.puremvc.java.patterns.observer.Notifier
facade
 
Constructor Summary
Proxy(java.lang.String proxyName)
          Constructor
Proxy(java.lang.String proxyName, java.lang.Object data)
          Constructor
 
Method Summary
 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
 

Constructor Detail

Proxy

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

Parameters:
proxyName -
data -

Proxy

public Proxy(java.lang.String proxyName)
Constructor

Parameters:
proxyName - Name of the Proxy
Method Detail

getProxyName

public java.lang.String getProxyName()
Get the proxy name

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

setData

public void setData(java.lang.Object data)
Set the data object

Specified by:
setData in interface IProxy
Parameters:
data -

getData

public java.lang.Object getData()
Get the data object

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

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