I am trying to declare a method, which will take any class implementing an interface as its parameter. Example:
interface ICache {...}
class SimpleCache implements ICache {...}
void doSomething(Class<ICache> cls) { /* Do something with that class */ }
But when I try to call it with SimpleCache.class
, it doesn't work. How can I implement this?