setField

open fun setField(field: Field, @Nullable target: @Nullable Any, @Nullable value: @Nullable Any)

Set the field represented by the supplied field object on the specified target object to the specified value.

In accordance with set semantics, the new value is automatically unwrapped if the underlying field has a primitive type.

This method does not support setting static final fields.

Thrown exceptions are handled via a call to handleReflectionException.

Parameters

field

the field to set

target

the target object on which to set the field (or null for a static field)

value

the value to set (may be null)