setFieldValue

fun Any.setFieldValue(fieldName: String, value: Any?)

Sets the value of the field named fieldName on this object using reflection.

Field lookups are cached per class for performance.

Parameters

fieldName

The name of the field to write.

value

The new value to assign.

Throws

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