Can someone help me with the code below?
I have 2 classes Controller1
and Controller2
implementing the interface Controllers as below:
package com.controllers
public interface Controllers{
public void method1(*****);
}
------------------------------
package com.controllers
public class Controller1{
public void method1(com.model1.Module1 module);
}
------------------------------
package com.controllers
public class Controller2{
public void method1(com.model2.Module1 module);
}
------------------------------
I have 2 packages which have the same classes (both classes have same methods as well) as below
package com.model1
public class Module1{
}
------------------------
package com.model1
public class Module2{
}
-----------------------
package com.model2
public class Module1{
}
------------------------
package com.model2
public class Module2{
}
I am using a Factory class to get the instance of either Controller1
or Controller2
at the runtime, so the argument types for method1
in the inherited classes will vary. But I am unable to so, as a method signature cannot be overridden.
Can someone suggest me with an alternative? Thanks...