类 Proxy中的方法:
newProxyInstance(ClassLoader loader, Class<?>[] interfaces, InvocationHandler h)
的第二个参数,在JDK中这样描述:interfaces - the list of interfaces for the proxy class to implement1、我如果 我有这么个接口:
public interface Subject {
public void requst();
}
2、有这么个类去实现这个接口:
public class RealSubject implements Subject {
public void requst() {
System.out.println("From real subject!");
}
}
我的目的只想获得最上面的 “interfaces”:
请问为什么可以这样去 获得:
realSubject.getClass().getInterfaces()
而不能这样去获得:
Subject.class.getInterfaces() ?
newProxyInstance(ClassLoader loader, Class<?>[] interfaces, InvocationHandler h)
的第二个参数,在JDK中这样描述:interfaces - the list of interfaces for the proxy class to implement1、我如果 我有这么个接口:
public interface Subject {
public void requst();
}
2、有这么个类去实现这个接口:
public class RealSubject implements Subject {
public void requst() {
System.out.println("From real subject!");
}
}
我的目的只想获得最上面的 “interfaces”:
请问为什么可以这样去 获得:
realSubject.getClass().getInterfaces()
而不能这样去获得:
Subject.class.getInterfaces() ?
取得 Class 对象的三种方式好像没有“interface”的情况,