Have been able to implement Class.cast(), which was easy. But newInstance() is pretty hard, no wonder it hasn't been implemented yet. Sorry for the noise...
On Apr 28, 12:03 pm, andrej <[email protected]> wrote: > Wrote the following code, and then realized that I can't translate > this to javascript: > > public <T extends Entity> T create(Class<T> type, long id) { > T t = type.newInstance(); > t.setId(id); > return type.cast(t); > } > > Two problems: > (1) Class.newInstance not implemented > (2) Class.cast not implemented > > Class.cast should be easy to implement, since it's pretty much just an > identity function. I.e. > type.cast(t) --> t > > Class.newInstance() seems also relatively easy to implement. Just > another prototype function to > the class literal object? > > This is regarding the following > issue:http://code.google.com/p/google-web-toolkit/issues/detail?id=487&can=... > > It's apparently low priority. But it seems it could be implemented > easily. Am I wrong? Can I add this > functionality myself? Any pointers? Unfortunately I'm just getting > started with GWT, so I don't have > a good understanding of how this works under the hood yet. > > Thank you --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
