This code traverses multiple models and each model can have a different template parameter. The code can also have a different number of leader and follower models. Kotlin does not have language features that will allow a single implementation to handle all cases. So code generation is required.
This automation is beneficial for 2 reasons:
it will allow new variations to be added quickly
it will also make it easy if/when new model classes are introduced.
This code traverses multiple models and each model can have a different template parameter. The code can also have a different number of leader and follower models. Kotlin does not have language features that will allow a single implementation to handle all cases. So code generation is required.
This automation is beneficial for 2 reasons: