Is there a difference between int and Integer?

39 views
Skip to first unread message

Alexander Orlov

unread,
Jan 18, 2012, 10:22:53 AM1/18/12
to google-we...@googlegroups.com
In Java, Integer is an object and can be set to null whereas int is a primitive and cannot be set to null.

In RequestFactory only the wrapped versions of primitives (= objects) are allowed. So you might use Boolean and Integer but not boolean and int. In GWT you can use both but does is affect the generated JavaScript code whether you use Integer or int?

Thomas Broyer

unread,
Jan 19, 2012, 11:08:49 AM1/19/12
to google-we...@googlegroups.com
RequestFactory works very well with primitive types; it's just that you can't use them as generic type-arguments in Java (this is a Java limitation), so any service method returning an "int" on the server-side will have to use Request<Integer> on the client-side. Everything else in RF can use primitives: service method arguments, and proxy getters and setters.
Reply all
Reply to author
Forward
0 new messages