Goktug Gokdogan has posted comments on this change.
Change subject: Utility to store multiple HandlerRegistrations
......................................................................
Patch Set 3:
(3 comments)
....................................................
File
user/src/com/google/web/bindery/event/shared/HandlerRegistrationCollection.java
Line 47: public static HandlerRegistrationCollection
create(HandlerRegistration... handlers) {
HandleRegistrations looks like a better approach here. We can call the
method compose. In that case we don't even need this class to be exposed.
We can just write a simple anonymous implementation:
public static HandlerRegistration compose(HandlerRegistration... handlers)
{
return new HandlerRegistration() {
@Override
public void removeHandler() {
for (HandlerRegistration hr : handlers) {
hr.removeHandler();
}
}
}
This pattern is pretty common in Guava. The main advantage is, you are
quite flexible in changing implementations as the exposed API is very
simple.
Line 55: private Set<HandlerRegistration> handlers = new
HashSet<HandlerRegistration>();
Any reason to go with Set instead of the simpler ArrayList?
Line 61: public void addHandlerRegistration(HandlerRegistration hr) {
If we end up going this way, just calling it "add" should be enough and
more compact.
We can accompany it with addAll that takes vararg and forward the create
call here.
--
To view, visit https://gwt-review.googlesource.com/3661
To unsubscribe, visit https://gwt-review.googlesource.com/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I75ccd120b78e1be47fa6a1e4f20c607c68203c31
Gerrit-PatchSet: 3
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Daniel Kurka <[email protected]>
Gerrit-Reviewer: Daniel Kurka <[email protected]>
Gerrit-Reviewer: Goktug Gokdogan <[email protected]>
Gerrit-Reviewer: Jens Nehlmeier <[email protected]>
Gerrit-Reviewer: Leeroy Jenkins <[email protected]>
Gerrit-Reviewer: Thomas Broyer <[email protected]>
Gerrit-HasComments: Yes
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
---
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.