I've been struggling with this for some time. I have an interface defined like this:
public interface SomeInterface {
String someMethod();
}
This will be implemented by a number of model classes, e.g.
public class SomeClass implements SomeInterace {
...
@Override
public String someMethod(){
...
}
}
Finally I have a 3rd class which needs to call the doSomething method, remember that I have multiple models that conform to SomeInterface. So I have the method defined as:
public class SomeUsefulClass {
public void doSomethingCool(Class<SomeInterface>aParam) {
//How do I specify aParam.someMethod(); A cast doesn't work
}
}