Title
k

kirillrakhman

05/24/2017, 3:53 PM
abstract class KnowsChildrenTypes() {
    companion object {
        val types = mutableSetOf<Class<out KnowsChildrenTypes>>()
    }
    
    init {
        types += this::class.java
    }
}

class Child1 : KnowsChildrenTypes()
class Child2 : KnowsChildrenTypes()
s

snowe

05/24/2017, 5:21 PM
@levans002 oops linked to wrong item. did you try something like this?
k

kirillrakhman

05/24/2017, 5:23 PM
no, just came up with it
s

snowe

05/24/2017, 5:26 PM
@kirillrakhman sorry, i was tagging my coworker so he would see this solution. Apparently this won't work for him because he needs to know what classes he can init before they are ever instantiated.
k

kirillrakhman

05/24/2017, 5:26 PM
then you'll need a classpath scan