org.bushe.swing.event.annotation
Class ProxyTopicSubscriber
java.lang.Object
org.bushe.swing.event.annotation.AbstractProxySubscriber
org.bushe.swing.event.annotation.ProxyTopicSubscriber
- All Implemented Interfaces:
- EventTopicSubscriber, ProxySubscriber
- Direct Known Subclasses:
- ProxyTopicPatternSubscriber
public class ProxyTopicSubscriber
- extends AbstractProxySubscriber
- implements EventTopicSubscriber
A class that subscribes to an EventService on behalf of another object.
Method Summary |
boolean |
equals(java.lang.Object obj)
|
void |
onEvent(java.lang.String topic,
java.lang.Object data)
Handles the event publication by pushing it to the real subscriber's subcription Method. |
java.lang.String |
toString()
|
protected void |
unsubscribe(java.lang.String topic)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
ProxyTopicSubscriber
public ProxyTopicSubscriber(java.lang.Object proxiedSubscriber,
java.lang.reflect.Method subscriptionMethod,
ReferenceStrength referenceStrength,
EventService es,
java.lang.String topic)
- Creates a proxy. This does not subscribe it.
- Parameters:
proxiedSubscriber
- the subscriber that the proxy will call when an event is publishedsubscriptionMethod
- the method the proxy will call, must have an Object as it's first and only parameterreferenceStrength
- if the subscription is weak, the reference from the proxy to the real subscriber should
be tooes
- the EventService we will be subscribed to, since we may need to unsubscribe when weak refs no longer
existtopic
- the topic to subscribe to, used for unsubscription only
onEvent
public void onEvent(java.lang.String topic,
java.lang.Object data)
- Handles the event publication by pushing it to the real subscriber's subcription Method.
- Specified by:
onEvent
in interface EventTopicSubscriber
- Parameters:
topic
- the topic on which the object is being publisheddata
- The Object that is being published on the topic.
unsubscribe
protected void unsubscribe(java.lang.String topic)
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class AbstractProxySubscriber
toString
public java.lang.String toString()
- Overrides:
toString
in class AbstractProxySubscriber