MCPcopy Index your code
hub / github.com/astonbitecode/j4rs / clone_instance

Method clone_instance

rust/src/api/mod.rs:1155–1171  ·  view source on GitHub ↗

Creates a clone of the provided Instance

(&self, instance: &Instance)

Source from the content-addressed store, hash-verified

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> {

Callers 2

load_fxmlMethod · 0.45
clone_instanceFunction · 0.45

Calls 5

opt_to_resFunction · 0.85
get_clone_static_methodFunction · 0.85
do_returnFunction · 0.85

Tested by 1

clone_instanceFunction · 0.36