Have we talked about adding an IEventDispatcher that dispatches events by
their class type based on event method signature?
Example:
class MyComponent {
@EventListener // or some annotation
public void onUserAddedEvent(UserAddedEvent event) {
// do something here
}
}
Then when someone calls sink(new UserAddedEvent()) it gets dispatched to
only those methods that take a UserAddedEvent as their method argument?
Would that be useful (it seems like it to me - it avoids the instanceof
checks)? Am I off track? Is there something like this or better already
built?
An alternative would be that the annotation could take an argument of event
class(es) that it want's to be notified of.
--
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket? Use Brix! http://brixcms.org*
On Tue, Jun 19, 2012 at 2:36 PM, Igor Vaynberg <[email protected]>wrote:
>
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.wicket/wicket-core/6.0.0-beta1/org/apache/wicket/EventDispatcherTest.java#EventDispatcherTest
>
> -igor
>
> On Tue, Jun 19, 2012 at 12:31 PM, Douglas Ferguson <[email protected]>
> wrote:
> > Where's the source repository located?
> >
> >
> > On Jun 19, 2012, at 2:20 PM, Martin Grigorov wrote:
> >
> >> See org.apache.wicket.EventDispatcherTest in wicket-core's tests
> >>
> >> On Tue, Jun 19, 2012 at 9:58 PM, Douglas Ferguson <[email protected]>
> wrote:
> >>> Anybody have a good pattern for using Events without having lots of
> instanceOf, if/else, or switch statements?
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: [email protected]
> >>> For additional commands, e-mail: [email protected]
> >>>
> >>
> >>
> >>
> >> --
> >> Martin Grigorov
> >> jWeekend
> >> Training, Consulting, Development
> >> http://jWeekend.com
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>