Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can GWT 2.1 editor framework support primitive types?

I am trying to bind a field of the primitive type "int" to an editor. My editor extends ValueBox<Integer>, since generics in Java can only use object types.

When I compile my application, I get the following error:

00:00:18,915 [ERROR] Found unexpected type int while evauating path "cadastralDivisionCode" using getter expression ""

Changing the getter and the setter to use an Integer object, does the trick. Is there any way to use a primitive type in the GWT 2.1 editor framework?

like image 862
Jan Avatar asked Nov 14 '10 08:11

Jan


2 Answers

You need to wait for 2.1.1 for primitive types. There is an open bug tracking this.

like image 141
Robert Munteanu Avatar answered Nov 18 '22 06:11

Robert Munteanu


Haven't looked at GWT internals, but most probably it can't be done, because primitive values are not handled by reference and can not be put into Collections.

The only way around is to use equivalent object types, e.g. Integer for int.

like image 24
Peter Knego Avatar answered Nov 18 '22 06:11

Peter Knego