I would like to know if Eclipse JDT is offering any API functions to instantiate an object from an IType.
We are using the Eclipse JDT search engine to retrieve classes with a particular interface, say Application that looks like this:
public interface Application {
void launch();
}
Using the JDT search engine, we are able to get an IType object that represents a class that implements the Application interface. Assume that the implementing class has a no-argument constructor.
What we try to achieve is to get a concrete Object from the IType. So, I would like to know if the JDT offers any API functions to do so.
If it does, we will use it to instantiate the IType. If it doesn’t, we will locate the containing projects, build a ClassLoader from it and then use reflection to instantiate the class directly.
Thansk in advance,
Matt
Nope. Reflection is the way to go.