Monday, June 15, 2015

How to search object instances by their type ?

Please some advice on the following situation (gwt 2.7.0):

From xml I generate display snippets like a menu with some different type of buttons that extends from a Button class.
In the code I need to find RichButton instances in the menu, that are a subclass of the Button class (for further decoration of the buttons).
What is the correct/best way to do this ? that is: to find them through their Type?

I got it realized by enabling the class meta data (I had it disabled by default): -XdisableClassMetaData.
And then using the Object.getClass() method and Class.getSuperClass() method to detect if the object is a (sub) instance of RichButton.

But is that the way to do it, or are there better ways ? (it feels a bit awkward)



--
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