I have an abstract class:
public abstract class RootProcessor {
Class clazz;
}
I need to fill ClassT clazz;
There is a post of the same subject: Reflecting generics
And a class that implement it:TypeArgumentsUtils.java
An example is in the unit test.
So if you have this class:
public class BarProcessor extends RootProcessor {
public BarProcessor() {
}
}
than you would get the first parameter with:
Class barClass = TypeArgumentsUtils.getFirstTypeArgument(
RootProcessor.class, BarProcessor.class);