public interface IMyInterface {
default String get() {
return "help";
}
}
Class settings = IMyInterface.class;
IMyInterface target = (IMyInterface) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[]{IMyInterface.class}, (o, method, objects) -> method.invoke(o,objects));
Method[] methods = settings.getMethods()
for(Method method : methods){
Object value = method.invoke(target);
}
Doesn't work object is not an instance of declaring class ?
Aucun commentaire:
Enregistrer un commentaire