the whole T : Foo typing is a bit weird. I get that what you want is only the sealed implementations of Foo, but Foo itself is of type Foo.
It sounds like you want it generic? So maybe
fun getFooObjects(): List<Foo> = Foo::class.sealedSubclasses.mapNotNull { it.objectInstance }
would do the trick
d
dave08
10/14/2021, 12:09 PM
I ended up with (for setting up the schemas in the db with exposed...) - the problem was that I can't inherit an interface from a class (Table) and SchemaUtils.xxx takes in Tables...:
This whole thing was to avoid having to keep a separate list of tables that I might forget to add new tables to... having them inherit the sealed interface is the easiest way to see if that object was added...