Using UUID in GWT?

4,982 views
Skip to first unread message

membersound

unread,
Feb 10, 2013, 1:02:30 PM2/10/13
to google-we...@googlegroups.com
Hi,

I tried using java.util.UUID on the client side to generate some unique id's for a list that will be placed into a CellTable.

Unfortunately GWT does probably not support UUID on the client side??
No source code is available for type java.util.UUID; did you forget to inherit a required module?

Or is it somehow possible to "inherit" UUID as the compiler tells me?

Thomas Broyer

unread,
Feb 10, 2013, 1:58:58 PM2/10/13
to google-we...@googlegroups.com


On Sunday, February 10, 2013 7:02:30 PM UTC+1, membersound wrote:
Hi,

I tried using java.util.UUID on the client side to generate some unique id's for a list that will be placed into a CellTable.

How about Document.get().createUniqueId() ?
 

Unfortunately GWT does probably not support UUID on the client side??
No source code is available for type java.util.UUID; did you forget to inherit a required module?

Or is it somehow possible to "inherit" UUID as the compiler tells me?

No it's not (unless someone, somewhere provides an emulated version of it in some module that you could <inherit/>) 

Jens

unread,
Feb 10, 2013, 1:59:56 PM2/10/13
to google-we...@googlegroups.com
UUID is not emulated by GWT so you can't use it out of the box.

Take a look at http://concentricsky.com/blog/2011/mar/emulating-jre-classes-gwt if you want to emulate UUID yourself. The link also covers CustomFieldSerializers that are needed for GWT-RPC if you want to send UUIDs over the wire.

Out of the box you can only use all the classes/methods listed at:


-- J.

Kody

unread,
Feb 10, 2013, 4:48:50 PM2/10/13
to google-we...@googlegroups.com
That's not possible in my case, as I want my Foo class to have a already a unique id on instantiation. As I'm just displaying all Foos in my CellTable and not using any DTO, I cannot use Document there...

2013/2/10 Thomas Broyer <t.br...@gmail.com>

How about Document.get().createUniqueId() ?

Mauro

unread,
Feb 12, 2013, 6:58:59 AM2/12/13
to google-we...@googlegroups.com
Take a look at the attached file. It works for me.

I hope it helps.

Mauro Oliveira
GUID.java

membersound

unread,
Feb 12, 2013, 8:45:08 AM2/12/13
to google-we...@googlegroups.com
Thanks, I will have a deeper look at this lateron.
At the moment, as you said, I provides UUID emulation and works.
Reply all
Reply to author
Forward
0 new messages