[英]How to get the signature of a method which is inside a Interface?
I have a class named Fruits.我有一个名为 Fruits 的 class。 Inside the class there is a interface named Sour.
class 内部有一个名为 Sour 的接口。 Inside the Interface I have a method GetItems();
在接口里面我有一个方法 GetItems();
public class Fruits
{
----------------
----------------
public interface Sour
{
public int GetItems();
}
}
How to get the signature of the GetItems() method?.如何获取 GetItems() 方法的签名? I want to use this signature in JNI GetMethodID method.
我想在 JNI GetMethodID 方法中使用这个签名。
Some class has to first implement that interface.一些 class 必须首先实现该接口。
Once a class has imlpemented an interface then you should be able to get the methodID for the interface method, which is now a member of the class that implemented it.一旦 class 实现了接口,那么您应该能够获取接口方法的 methodID,该方法现在是实现它的 class 的成员。
You can't use JNI without a class implementing your Interface.如果没有实现您的接口的 class,您将无法使用 JNI。 Just use the signature of this implementing class.
只需使用此实现 class 的签名即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.