getReflectedField

external fun getReflectedField(declaringClass: Class<*>, name: String, jniSig: String, isStatic: Boolean? = null): Field?

Retrieve a reflected Field object using native lookup.

----------------

通过 Native 查找并获取反射 Field 对象。

// Get instance field "value" from String
getReflectedField(String::class.java, "value", "[B")

// Get static field "CASE_INSENSITIVE_ORDER" from String
getReflectedField(String::class.java, "CASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;")

Return

The reflected Field object, or null if not found / 反射的 Field 对象,如果未找到则返回 null

Parameters

declaringClass

declared class / 声明该字段的类

name

field name / 字段名称

jniSig

type signature of the field / 字段的类型签名

isStatic

If null, native auto check / 如果为 null,native 自动判断