Showing results for 
Search instead for 
Did you mean: 

Flexible Serch with add.quert parameter of type integer

Former Member
0 Kudos

Hi Team,

While writing flexible query, query.addQueryParameter("key", value); In this line do we always need to specify value is of type String. In my case i just take it as integer value,so in ee it shows an error "The expression of type int is boxed into Integer". Please help me to solve this.

View Entire Topic
Active Contributor
0 Kudos

Sounds like you've got your Ee project configured to show boxing as an error. To make your error go away do the boxing yourself


 int myInt = 1;
 query.addQueryParameter("key", Integer.valueOf(myInt));

but then this is the sort of verbosity that autoboxing was intended to do away with so you might prefer to just relax the error to a warning in the project settings

It's a shame that Ee treats boxing and unboxing conversions as the same problem. As far as I'm concerned boxing an int into an Integer is fine, but unboxing an Integer to an int is a potential Null Pointer Exception.


 Integer i = thisMethodReturnsANullInteger();
 int result = 1 * i; // npe when auto unboxing from Integer to int
Former Member
0 Kudos

Hi Andrew,

Thank you for your time.

Information is very useful.