Not sure if this is the right channel, but is ther...
# codingconventions
n
Not sure if this is the right channel, but is there a way to iterate over all the possible
KClass<*>
implementers of a
sealed interface
? I know you can use the
when
condition when you have an object instance, but I'm curious if I can iterate over all the possible KClasses there could be.
m
I believe there is a
KClass<*>
property called
sealedSubclasses
, is that what you are looking for? IIRC, it will have entries if the class is a sealed interface/class and has sub-classes, otherwise it will be empty.
n
Yes! Thank you. I didn't realize that existed.