I have a JNI method to access java method which returns an Integer object. I do not want to return the primitive int type because this code will be modified to handle Generic objects. The following is what I have. I am not able to get the value of the Integer that I pass. The output at C++ side is something like
How can I get the actual value of Integer object that I pass, at the C++ end?
The value jobject is a pointer (yes, actual pointer. After all, this is C++) to the Integer object (or at least a pointer to something that represents the Integer object). To get its value you need to do the following:
- make sure it isn't NULL!
- get its class
- using the class, get the intValue() method
- call that method, the result is a jint.