# createInstanceAsTypeOrNull

inline fun < T : Any > Class <*>. createInstanceAsTypeOrNull (vararg args: Any ?, isPublic: Boolean = true): T ?

Create an instance of Class with the given arguments and cast it to the specified type T or return null if not found.

#### Return

T or null if no suitable constructor is found or the instance cannot be cast to type T.

#### See also

createInstance
createInstanceOrNull
createInstanceAsType

inline fun < T : Any > KClass <*>. createInstanceAsTypeOrNull (vararg args: Any ?, isPublic: Boolean = true): T ?

Create an instance of KClass.java with the given arguments and cast it to the specified type T or return null if not found.

#### See also

createInstanceAsTypeOrNull