Java Interface Reflection Alternatives
- by Phaedrus
I am developing an application that makes use of the Java Interface as more than a Java interface, i.e., During runtime, the user should be able to list the available methods within the interface class, which may be anything:
private Class<? extends BaseInterface> interfaceClass.
At runtime, I would like to enum the available methods, and then based on what the user chooses, invoke some method.
My question is: Does the Java "Interface" architecture provide any method for me to peek and invoke methods without using the Reflection API?
I wish there were something like this (Maybe there is):
private Interface<? extends BaseInterface> interfaceAPI;
public void someMethod(){
interfaceAPI.listMethods();
interfaceAPI.getAnnotations();
}
Maybe there is some way to use Type Generics to accomplish what I want?
Thanks,
Phaedrus