to Class Or Null
Convert String class name to Class with ClassLoader and initialize.
Receiver
the class name to be converted.
Return
Class or null if the class not found.
Parameters
loader
ClassLoader to load the class, default is ClassLoaderProvider.classLoader.
initialize
whether to initialize the class with loader, default is false.
See also
fun <T : Any> String.toClassOrNull(loader: ClassLoader? = null, initialize: Boolean = false): Class<T>?
Convert String class name to Class with ClassLoader and initialize.
Return
Class<T> or null if the class not found or type cast failed.
See also
Safely convert Type to Class or return null if it fails.
Receiver
the Type to be converted.
Return
See also
Safely convert Type to Class or return null if it fails.
Return
Class or null.