Created
June 8, 2019 14:31
-
-
Save markmaynard/a45a2648aeb179fc10441e0233884e49 to your computer and use it in GitHub Desktop.
Fake Class function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun <reified T: SomeThing> ThingFactory(clazz: KClass<T>): ThingFactory? = | |
when(clazz) { | |
Thing1::class -> ThingFactory(ThingFactory.ThingType.Thing1Type) | |
Thing2::class -> ThingFactory(ThingFactory.ThingType.Thing2Type) | |
else -> throw RuntimeException("Unknown type: $clazz") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment