This seems a basic java question.
I have one interface, Pipeline
, which has a method execute(Stage)
.
Then I create a sub interface to extend from Pipeline
, say BookPipeline
, I like the method to be execute(BookStage)
.
BookStage
extends from Stage
.
Seems this kind of definition could not pass java compile.
Any suggestion on that?
You may want to consider using generics.
public interface Pipeline<T extends Stage> {
public void execute(T stage);
}
public interface BookPipeline extends Pipeline<BookStage> {
@Override
public void execute(BookStage stage);
}
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