getFieldValue

fun <T> Any.getFieldValue(fieldName: String): T

Returns the value of the field named fieldName from this object using reflection.

Field lookups are cached per class for performance.

Parameters

fieldName

The name of the field to read.

Type Parameters

T

The expected type of the field value.

Throws

if the field does not exist on this object's class.