Thursday, June 26, 2014

Why not use class name as the TYPE of the event

Hi all,

A custom event needs to have a TYPE variable to denote the type of the event. For example:

public class LogoutEvent extends Event<LogoutEventHandler>
public static Type<LogoutEventHandler> TYPE = new Type<LogoutEventHandler>();
protected void dispatch(LogoutEventHandler handler)

public<LogoutEventHandler> getAssociatedType()
return TYPE;


I am just curious about the need to have the TYPE field. Why GWT could not use the class name of the event(in this case LogoutEvent) to denote the type of the event. Only purpose I see of this type is to have it as a key in the map of events and their handlers. I think even the class name could have served as the key in this map.


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
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment