I'm having the following classes/interfaces:
public class GenericViewModel<T extends AbstractDatabaseObject> {
private Class<?> type;
@SuppressWarnings("unchecked")
public GenericViewModel(Class<?> cl) {
type = cl;
}
}
and a specialization:
public class PersonViewModel extends GenericViewModel<Person> implements IPersonViewModel{
public PersonViewModel() {
super(Person.class);
}
}
Now, my problem is in the presenter:
public class GenericPresenter implements IGenericView.IGenericViewListener {
private GenericViewModel<AbstractDatabaseObject> model;
private IGenericView view;
public GenericPresenter(GenericViewModel<AbstractDatabaseObject> model, IGenericView view) {
this.model = model;
this.view = view;
view.addListener(this);
}
}
To be more precise, I cannot call the constructor of the super class with the given arguments:
public class PersonPresenter extends GenericPresenter {
PersonViewModel model;
IPersonView view;
public PersonPresenter(PersonViewModel model, IPersonView view) {
super(model, view); // Here is the problem. No such constructor in superclass found
// IGenericView i = (IGenericView) view; <-- this seems to work
// GenericViewModel<AbstractDatabaseObject> m = model; <-- this doesn't
}
}
What do I have to change?
private GenericViewModel<? extends AbstractDatabaseObject> model;?super:super( (GenericViewModel<AbstractDatabaseObject>) model, (IGenericView) view);