Consumes this InvocationArg and transforms it to an InvocationArg that contains a Java primitive, leveraging Java's autoboxing. This action can be done by calling `Jvm::cast` of Instances as well (e.g.: jvm.cast(&instance, "int")) but calling `into_primitive` is faster, as it does not involve JNI calls.
(self)
| 193 | /// This action can be done by calling `Jvm::cast` of Instances as well (e.g.: jvm.cast(&instance, "int")) |
| 194 | /// but calling `into_primitive` is faster, as it does not involve JNI calls. |
| 195 | pub fn into_primitive(self) -> errors::Result<InvocationArg> { |
| 196 | let mut ia = self; |
| 197 | ia.make_primitive()?; |
| 198 | Ok(ia) |
| 199 | } |
| 200 | |
| 201 | /// Creates a `jobject` from this InvocationArg. |
| 202 | pub fn as_java_ptr_with_global_ref(&self, jni_env: *mut JNIEnv) -> errors::Result<jobject> { |