Let's say I have an interface
interface I {}
and two implementations thereof, class A implements I {} and class B implements I {}
Now I would like to write a generic method which accepts a class-type parameter bounded by "Implements interface I", e.g.
boolean <T> isOK ( Class<T extents I> cl ) {
switch ( cl ) {
case A.class: return true ;
case B.class: return false;
}
}
How to do that?
T-- the declarationboolean isOK ( Class<? extents I> cl )would be equivalent