I want to find the class name of the argument sent to the generic class as follows.
public abstract class RootClass
<T extends Iface
> {
protected ApplicationContext applicationContext;
public T getIfaceBean() {
return applicationContext.getBean(T.class);
}
}
But it looks like I can't do T.class
(due to Type Erasure?).
So, Is such an action possible with Java Generics ?
How can I achieve this type of functionality with Java Generics?