//core/io.github.serpro69.kfaker/randomClassInstance
randomClassInstance¶
[jvm]\ inline fun <T : Any> randomClassInstance(configurator: RandomProviderConfig.() -> Unit = {}): T
Creates an instance of T. If T has a parameterless public/internal constructor then it will be used to create an instance of this class, otherwise a constructor with minimal number of parameters will be used with randomly-generated values.
Parameters¶
jvm
configurator | configure random class instance creation |
Throws¶
NoSuchElementException | if T has no public or internal constructor. |
[jvm]\ inline fun <T : Any> randomClassInstance(fakerConfig: FakerConfig): T
Creates an instance of T. If T has a parameterless public/internal constructor then it will be used to create an instance of this class, otherwise a constructor with minimal number of parameters will be used with randomly-generated values.
Parameters¶
jvm
fakerConfig | configure RandomClassProvider via the FakerConfig |
Throws¶
NoSuchElementException | if T has no public or internal constructor. |
[jvm]\ fun <T : Any> randomClassInstance(kClass: KClass<T>, configurator: RandomProviderConfig.() -> Unit = {}): T
Creates an instance of T from the KClass input. If T has a parameterless public/internal constructor then it will be used to create an instance of this class, otherwise a constructor with minimal number of parameters will be used with randomly-generated values.
Parameters¶
jvm
kClass | a KClass of T |
configurator | configure random class instance creation |
Throws¶
NoSuchElementException | if T has no public or internal constructor. |
[jvm]\ fun <T : Any> randomClassInstance(kClass: KClass<T>, fakerConfig: FakerConfig): T
Creates an instance of T from the KClass input. If T has a parameterless public/internal constructor then it will be used to create an instance of this class, otherwise a constructor with minimal number of parameters will be used with randomly-generated values.
Parameters¶
jvm
kClass | a KClass of T |
fakerConfig | configure RandomClassProvider via the FakerConfig |
Throws¶
NoSuchElementException | if T has no public or internal constructor. |