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

findField

@Nullable open static fun findField(clazz: Class<*>, name: String): Field

Attempt to find a Field on the supplied Class with the supplied name. Searches all superclasses up to Object.

Parameters

clazz - the class to introspect

name - the name of the field

Return
the corresponding Field object, or null if not found

@Nullable open static fun findField(clazz: Class<*>, @Nullable name: String, @Nullable type: Class<*>): Field

Attempt to find a Field on the supplied Class with the supplied name and/or Class. Searches all superclasses up to Object.

Parameters

clazz - the class to introspect

name - the name of the field (may be null if type is specified)

type - the type of the field (may be null if name is specified)

Return
the corresponding Field object, or null if not found