fieldValueByTypeOrNullAs

fun <T> Any.fieldValueByTypeOrNullAs(type: Class<*>, isStatic: Boolean = false): T?

按字段类型读取字段值并转为指定类型,失败时返回 null

Parameters

type

字段类型

isStatic

是否读取静态字段