I wrote two classes look like this
class SomeClient {
ResponseEntity<SomeResponse> getSome(...) { // SomeResponse is a concrete class
}
ResponseEntity<SomeOtherResponse> getSomeOther(...) { // SomeOtherResponse is a concrete class
}
}
class SomeReactiveClient {
Mono<SomeResponse> getSome(...) {
}
Mono<SomeOtherResponse> getSomeOther(...) {
}
}
These two methods in each classes has same name and parameters. And only diffs for their return type.
Can I define an interface with an generic type parameter for ResponseEntity
and Mono
?
Say,
interface ISomeClass<T> {
T<SomeResponse> getSome();
T<SomeOtherResponse> getSomeOther();
}
Is there any design pattern for this?