mirror of
https://github.com/netbirdio/gomobile-tvos-fork.git
synced 2026-05-22 18:43:29 -07:00
bind: support casting of Java objects
Generate Cast functions that take a proxy for a Java class or interface, and return a new proxy with the same reference. The Cast functions panic if the underlying Java object is not an instance of the expected type. Change-Id: I08a5bf9a79139f0fac5dd102c7b028c8c989fc6d Reviewed-on: https://go-review.googlesource.com/30095 Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
@@ -382,3 +382,11 @@ void go_seq_release_byte_array(JNIEnv *env, jbyteArray arr, jbyte* ptr) {
|
||||
(*env)->ReleaseByteArrayElements(env, arr, ptr, 0);
|
||||
}
|
||||
}
|
||||
|
||||
int go_seq_isinstanceof(jint refnum, jclass clazz) {
|
||||
JNIEnv *env = go_seq_push_local_frame(0);
|
||||
jobject obj = go_seq_from_refnum(env, refnum, NULL, NULL);
|
||||
jboolean isinst = (*env)->IsInstanceOf(env, obj, clazz);
|
||||
go_seq_pop_local_frame(env);
|
||||
return isinst;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user