//core/io.github.serpro69.kfaker.provider.misc/RandomClassProvider
RandomClassProvider¶
[jvm]\ class RandomClassProvider
Provider functionality for generating random class instances.
Inspired by Creating a random instance of any class in Kotlin blog post.
Functions¶
Name | Summary |
---|---|
configure | [jvm] fun configure(configurator: RandomProviderConfig.() -> Unit) Applies configurator to this RandomClassProvider. |
copy | [jvm] fun copy(): RandomClassProvider Creates a copy of this RandomClassProvider instance with a copy of its config. |
new | [jvm] fun new(): RandomClassProvider Creates a new instance of this RandomClassProvider. |
randomClassInstance | [jvm] inline fun <T : Any> randomClassInstance(): T 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. [jvm] fun <T : Any> randomClassInstance(kClass: KClass<T>): T 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. |
reset | [jvm] fun reset() Resets config to defaults for this RandomClassProvider instance. |