Consider the interfaces
public interface SuperInterface {
public void execute(Map<String,object> argument);
}
public interface SubInterface extends SuperInterface {
public void execute(Argument extra , Map<String,Object> args);
}
Is it possible to completely override SuperInterfaces.execute with SubInterface.execute even though it has different arguments ?
OR
Am I doing it wrong ? What is the right way to design this spec ?
No. When you override a method, it must have the same number and types of arguments. Currently you are overloading the execute method in SubInterface.
You could, however, call execute(Map<String, Object> args) from execute(Argument extra , Map<String, Object> args) from your implementation of SubInterface.
Is it possible to completely override SuperInterfaces.execute with SubInterface.execute even though it has different arguments ?
If you are allowed to do this, you will breach an agreement.
Am I doing it wrong ?
Yes, of course.
What is the right way to design this spec ?
You can't disobey an agreement. So, you can't do like this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With