Monday, September 29, 2014

ANN: flatbus 1.1 released

A new flatbus is available with some minor improvements in the maven build and a public maven repo.

Flatbus is a GWT library/generator which generate at runtime an event bus that works without events: listeners register their interfaces on the bus and clients can invoke directly methods on those interfaces. Technically that works by specifying a bus interface which implements all listener interfaces. Flatbus will then generate a bus implementation which exposes that bus interface.

In a traditional setting you'd use an event/handler pair:

interface ContactDetailsUpdatedHandler{

   void onContactDetailsUpdated(ContactDetailsEvent e);
}

class ContactDetailsEvent{
...
}

A handler implementation would look like this:

class ContactDetailsUpdatedHandlerImpl implements ContactDetailsUpdatedHandler{

void onContactDetailsUpdated(ContactDetailsEvent e){
...
}

}

And you would communicate with it like this:

bus.fireEvent(new ContactDetailsUpdatedEvent(contactDetails));

With a flatbus, you don't create events but call methods directly:

interface ContactDetailsUpdatedHandler{

   void onContactDetailsUpdated(ContactDetails c);
}

class ContactDetailsUpdatedHandlerImpl implements ContactDetailsUpdatedHandler{

void onContactDetailsUpdated(ContactDetails c){
...
}

}


And you would communicate with it like this:

bus.onContactDetailsUpdated(new ContactDetails(...));

[1] https://github.com/ggeorgovassilis/flatbus

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment