constructObjectQuietly

fun constructObjectQuietly(classpath: String, parameterTypes: List<Class<*>> = emptyList(), args: List<Any?> = emptyList()): Any?

Invokes a constructor and consumes all errors.

Given a class: Thing(type: String)

Constructs via: val something: Thing? = constructObjectQuietly("foo.bar.Thing", listOf(String::class.java), listOf("hello"))

Parameters

classpath
  • The full name of the class