I'm trying to use a Class<?>
in an if statement, like the following:
public static Model get(Class<? extends FooBase> type, long id )
{
switch (type)
{
case FooType.class:
return new Foo(id);
break;
}
}
However, the line: case FooType.class:
is giving me the error,
Expected Class<capture<? extends FooBase>> , given Class<FooType.class>
.
FooType
does implement the FooBase
interface.
Is it not possible to do a switch on Class<?>
values?