Creates a clone of the provided Instance
(&self, instance: &Instance)
| 1153 | |
| 1154 | /// Creates a clone of the provided Instance |
| 1155 | pub fn clone_instance(&self, instance: &Instance) -> errors::Result<Instance> { |
| 1156 | unsafe { |
| 1157 | // Call the clone method |
| 1158 | let java_instance = (opt_to_res(cache::get_jni_call_static_object_method())?)( |
| 1159 | self.jni_env, |
| 1160 | cache::get_class_to_invoke_clone_and_cast()?, |
| 1161 | cache::get_clone_static_method()?, |
| 1162 | instance.jinstance, |
| 1163 | ); |
| 1164 | |
| 1165 | // Create and return the Instance |
| 1166 | Self::do_return( |
| 1167 | self.jni_env, |
| 1168 | Instance::from_jobject_with_global_ref(java_instance)?, |
| 1169 | ) |
| 1170 | } |
| 1171 | } |
| 1172 | |
| 1173 | /// Invokes the static method `method_name` of the class `class_name`, passing an array of `InvocationArg`s. It returns an `Instance` as the result of the invocation. |
| 1174 | pub fn cast(&self, from_instance: &Instance, to_class: &str) -> errors::Result<Instance> { |