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 whi开发者_开发知识库le 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?
You need to wait for 2.1.1 for primitive types. There is an open bug tracking this.
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
.
精彩评论