get Object Or Null Until Superclass As
fun <T> getObjectOrNullUntilSuperclassAs(obj: Any, fieldName: String, untilSuperClass: Class<*>.() -> Boolean? = null): 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 it is null or cast failed.
Parameters
obj
object
field Name
field name
until Super Class
until super class(true = break, false = continue), null = find in all superclasses.
Throws
if the field is not found