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

findMethodWithMinimalParameters

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

Find a method with the given method name and minimal parameters (best case: none), 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.getMethods first, falling back to findDeclaredMethodWithMinimalParameters. This allows for finding 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

Exceptions

IllegalArgumentException - if methods of the given name were found but could not be resolved to a unique method with minimal parameters

Return
the Method object, or null if not found

See Also
Class#getMethods#findDeclaredMethodWithMinimalParameters

@Nullable open static fun findMethodWithMinimalParameters(methods: Array<Method>, methodName: String): Method

Find a method with the given method name and minimal parameters (best case: none) in the given list of methods.

Parameters

methods - the methods to check

methodName - the name of the method to find

Exceptions

IllegalArgumentException - if methods of the given name were found but could not be resolved to a unique method with minimal parameters

Return
the Method object, or null if not found