on 11-24-2017 5:10 AM
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.
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
e.g.
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.
e.g.
Integer i = thisMethodReturnsANullInteger();
int result = 1 * i; // npe when auto unboxing from Integer to int
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.