getObjectOrNullAs

fun <T> getObjectOrNullAs(obj: Any, fieldName: String): T?

Get the field object by the name in the object, and trying to cast to the T type.

Return

T field object, or null if is null or cast failed.

Parameters

obj

object

fieldName

field name

Throws

if the field is not found