public class ProxyTopicSubscriber extends AbstractProxySubscriber implements EventTopicSubscriber, VetoTopicEventListener
@org.bushe.swing.event.annotation.EventTopicSubscriber
. Advanced EventBus
users could use this class in Aspect-Oriented code. Consider using the
AnnotationProcessor
instead, it may suit your needs and be easier.veto
Constructor and Description |
---|
ProxyTopicSubscriber(Object proxiedSubscriber,
Method subscriptionMethod,
ReferenceStrength referenceStrength,
EventService es,
String topic,
boolean veto)
Creates a proxy.
|
ProxyTopicSubscriber(Object proxiedSubscriber,
Method subscriptionMethod,
ReferenceStrength referenceStrength,
int priority,
EventService es,
String topic,
boolean veto)
Creates a proxy.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
void |
onEvent(String topic,
Object data)
Handles the event publication by pushing it to the real subscriber's subscription Method.
|
boolean |
shouldVeto(String topic,
Object data)
Determine whether a topic publication should be vetoed or allowed.
|
String |
toString() |
protected void |
unsubscribe(String topic) |
getEventService, getPriority, getProxiedSubscriber, getReferenceStrength, getSubscriptionMethod, hashCode, proxyUnsubscribed, retryReflectiveCallUsingAccessibleObject
public ProxyTopicSubscriber(Object proxiedSubscriber, Method subscriptionMethod, ReferenceStrength referenceStrength, EventService es, String topic, boolean veto)
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 onlyveto
- if this proxy is for a veto subscriberpublic ProxyTopicSubscriber(Object proxiedSubscriber, Method subscriptionMethod, ReferenceStrength referenceStrength, int priority, EventService es, String topic, boolean veto)
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 onlyveto
- if this proxy is for a veto subscriberpublic void onEvent(String topic, Object data)
onEvent
in interface EventTopicSubscriber
topic
- the topic on which the object is being publisheddata
- The Object that is being published on the topic.public boolean shouldVeto(String topic, Object data)
VetoTopicEventListener
Prerequisite: VetoTopicEventListener has to be subscribed with the EventService for the topic name.
Guaranteed to be
called in the SwingEventThread when using the SwingEventService (EventBus). See EventService
shouldVeto
in interface VetoTopicEventListener
topic
- The topic name the data object is published on.data
- The data object being published on the topic.protected void unsubscribe(String topic)
public boolean equals(Object obj)
equals
in class AbstractProxySubscriber
public String toString()
toString
in class AbstractProxySubscriber
Copyright © 2013 Bushe Enterprises, Inc.. All rights reserved.