spring-framework / org.springframework.beans / BeanUtils / findMethod

findMethod

@Nullable open static fun findMethod(clazz: Class<*>, methodName: String, vararg paramTypes: Class<*>): Method

Find a method with the given method name and the given parameter types, declared on the given class or one of its superclasses. Prefers public methods, but will return a protected, package access, or private method too.

Checks Class.getMethod first, falling back to findDeclaredMethod. This allows to find public methods without issues even in environments with restricted Java security settings.

Parameters

clazz - the class to check

methodName - the name of the method to find

paramTypes - the parameter types of the method to find

Return
the Method object, or null if not found

See Also
Class#getMethod#findDeclaredMethod