geniuses.
I'm using the following code for extracting user-defined extract (T).
public class Extractor<T extends MostSimpleExtract> {
private final Constructor<? extends T> extractConstructor;
public Extractor(Class<T> ExtractClass) throws NoSuchMethodException {
this.extractConstructor = ExtractClass.getConstructor();
}
}
So I have to instantiate my Extractor like:
Extractor<MostSimpleExtract> extractor = new Extractor<>(MostSimpleExtract.class);
But it I do not need to pass a class argument (MostSimpleExtract.class) to use ArrayList:
ArrayList<MostSimpleExtract> extractList = new ArrayList<>();
Passing a class argument to a constructor seems redundant because the class information is already there inside brackets.
How should I declare the class to get a constructor using generic type T without passing class argument to a constructor?
edit:
What I meant was that if there is any way to get constructor without passing a class argument, thus, I want to instantiate my Extractor class like:
Extractor<MostSimpleExtract> extractor = new Extractor<>();