FromReflectedMethod
Converts a
java.lang.reflect.Method
or java.lang.reflect.Constructor
object to a method ID.LINKAGE:
Index 7 in the JNIEnv interface function table.
Example of FromReflectedMethod
#include <jni.h> /* * Method: org.apache.harmony.vts.test.vm.jni.reflection.FromReflectedMethodTest.nativeExecute(Ljava/lang/reflect/Method;)Z */ JNIEXPORT jboolean JNICALL Java_org_apache_harmony_vts_test_vm_jni_reflection_FromReflectedMethodTest_nativeExecute (JNIEnv *env, jobject this_object, jobject mRefl) { jmethodID mID1, mID2; jclass strClass; mID1 = (*env)->FromReflectedMethod(env, mRefl); if(!mID1) return JNI_FALSE; strClass = (*env)->FindClass(env, "java/lang/String"); mID2 = (*env)->GetMethodID(env, strClass, "length", "()I"); if(!mID2) return JNI_FALSE; if(mID1 != mID2) return JNI_FALSE; return JNI_TRUE; } /* * Method: org.apache.harmony.vts.test.vm.jni.reflection.FromReflectedMethodTest.nativeExecute1(Ljava/lang/reflect/Constructor;)Z */ JNIEXPORT jboolean JNICALL Java_org_apache_harmony_vts_test_vm_jni_reflection_FromReflectedMethodTest_nativeExecute1 (JNIEnv *env, jobject this_object, jobject cRefl) { jmethodID mID1, mID2; jclass strClass; mID1 = (*env)->FromReflectedMethod(env, cRefl); if(!mID1) return JNI_FALSE; strClass = (*env)->FindClass(env, "java/lang/String"); mID2 = (*env)->GetMethodID(env, strClass, "<init>", "(Ljava/lang/String;)V"); if(!mID2) return JNI_FALSE; if(mID1 != mID2) return JNI_FALSE; return JNI_TRUE; }