EventBus: onEvent signature

20 views
Skip to first unread message

Farrukh Najmi

unread,
Apr 23, 2009, 11:12:10 PM4/23/09
to miha...@gmail.com, smartgwt-...@googlegroups.com
Hi Mihai,

I am wondering why the TopicSubscriber.onEvent method needs to have a Subscription as its first parameter:

public void onEvent(Subscription subscription, T event);

Would it not be simpler to just have the following (as it was originally):

public void onEvent(String topic, T event);

The current signature (listed first above) requires an extra step in onEvent methods to get the topic for comparison.

Just curious what your thought was on that? Thanks.

--
Regards,
Farrukh

Farrukh Najmi

unread,
Apr 24, 2009, 8:36:26 AM4/24/09
to Mihai, smartgwt-...@googlegroups.com

Extensibility sounds like a good reason. Thanks.

On Fri, Apr 24, 2009 at 3:34 AM, Mihai <miha...@gmail.com> wrote:
Well yes, but I use the Subscription so that I could remove from topic
inside the onEvent method. Right now you could still do that using
only a string but what if things evolve? then you need to change the
signature from String to something else again. This way no matter what
you don't need to change signature onEvent(Subscription subscription,
T event); and mantain backward compatibility. Any new thing could be
added to Subscription class without interfering with old
implementations used by people.



--
Regards,
Farrukh
Reply all
Reply to author
Forward
0 new messages