spring-framework / org.springframework.util / ReflectionUtils / getField

getField

@Nullable open static fun getField(field: Field, @Nullable target: Any): Any

Get the field represented by the supplied Field on the specified Object. In accordance with Field#get(Object) semantics, the returned value is automatically wrapped if the underlying field has a primitive type.

Thrown exceptions are handled via a call to #handleReflectionException(Exception).

Parameters

field - the field to get

target - the target object from which to get the field

Return
the field's current value