使用JNI调用Java方法时,什么是“Method Signature”参数?
我想在Qt中使用JNI调用Android Java方法。 有一个奇怪的“方法签名”参数,我无法理解。 这是什么以及如何设置?
在例子中,它类似于(II)I
或(I)I
。 这是什么意思?
例如:
jint max = QAndroidJniObject::callStaticMethod("java/lang/Math", "max", "(II)I", a, b);
这些都在文档中解释过。 http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html
Type Signature Java Type Z boolean B byte C char S short I int J long F float D double L fully-qualified-class ; fully-qualified-class [ type type[] ( arg-types ) ret-type method type
你的(II)I
是一个以两个整数作为参数并返回一个int的方法。 例如int m(int i, int j)
。
方法void print(String message)
将是(Ljava/lang/String;)