Let’s say I have a class container like this:
class Container<A,B,C,D,E>
Then I have a handler like this:
interface Handler<A,B,C,D,E, Z>{
fun map(c:Container<A,B,C,D,E>):Pair<Z, Container<A,B,C,D,E>>
fun add(c1:Container<A,B,C,D,E>, c2:Container<A,B,C,D,E>):Pair<Z, Container<A,B,C,D,E>>
}
Later I want to add another generic to container and handler, let’s call it F.
Or i want to remove B and C from container and handler.
Currently I have to make change at multiple places of the code, but I would like to have an opportunity to change the code not so often.
Like to create a typealias in handler:
typealias HContainer = Container<A,B,C,D,E>
So that code would look like this:
interface Handler<A,B,C,D,E, Z>{
fun map(c:HContainer):Pair<Z, HContainer>>
fun add(c1:HContainer, c2:HContainer):Pair<Z, HContainer>
}
But would still be using generics, just not be able to see.
Is there any way to achieve, what I want?