What I want to do is the following:
public class DBManager<T extends Type , Q extends Query>{
T create(T t);
Collection<T> read(Q query);
T update(T t);
}
However, I only want instantiations of this class where T and Q are related. For instance, if T is AppleType, then I want Q to be AppleQuery and not PearQuery.
Is there a way to do this, or produce a similar behavior?
I tried Q extends T & Query
, but that isn't allowed.