You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently oneof fields are generated as sealed traits with every variant resulting in two methods to the trait:
isFoo: Boolean
foo: Option[Foo]
Because it's a trait, the methods are mixed in to the $n$ subclasses (variants).
So in total, there are $2n^2$ methods generated.
In contrast, Abstract class methods are not mixed in.
So for oneof fields with many variants, it would be beneficial to generate an abstract class.
The text was updated successfully, but these errors were encountered:
joroKr21
changed the title
Add an option to generate oneof fields as an abstract class
Add an option to generate oneof fields as a sealed abstract class
May 19, 2024
Currently oneof fields are generated as sealed traits with every variant resulting in two methods to the trait:
isFoo: Boolean
foo: Option[Foo]
Because it's a trait, the methods are mixed in to the$n$ subclasses (variants).$2n^2$ methods generated.
So in total, there are
In contrast, Abstract class methods are not mixed in.
So for oneof fields with many variants, it would be beneficial to generate an abstract class.
The text was updated successfully, but these errors were encountered: