(&self, instance: Instance)
| 1361 | } |
| 1362 | |
| 1363 | pub fn to_rust_deserialized<T>(&self, instance: Instance) -> errors::Result<T> |
| 1364 | where |
| 1365 | T: DeserializeOwned + Any, |
| 1366 | { |
| 1367 | unsafe { |
| 1368 | debug("Invoking the getJson method"); |
| 1369 | // Call the getJson method. This returns a localref |
| 1370 | let json_instance = (opt_to_res(cache::get_jni_call_object_method())?)( |
| 1371 | self.jni_env, |
| 1372 | instance.jinstance, |
| 1373 | cache::get_get_json_method()?, |
| 1374 | ); |
| 1375 | let _ = Self::do_return(self.jni_env, "")?; |
| 1376 | debug("Transforming jstring to rust String"); |
| 1377 | let global_json_instance = |
| 1378 | jni_utils::create_global_ref_from_local_ref(json_instance, self.jni_env)?; |
| 1379 | let json = jni_utils::jstring_to_rust_string(self, global_json_instance as jstring)?; |
| 1380 | jni_utils::delete_java_ref(self.jni_env, global_json_instance); |
| 1381 | Self::do_return(self.jni_env, serde_json::from_str(&json)?) |
| 1382 | } |
| 1383 | } |
| 1384 | |
| 1385 | /// Deploys an artifact in the default j4rs jars location. |
| 1386 | /// |
no test coverage detected