findMethodCandidatesByName static method

Set<Method> findMethodCandidatesByName(
  1. Class clazz,
  2. String methodName
)

Retrieves the set of methods with the specified name from the given class.

  • Parameters clazz: the class to analyze for methods methodName: the name of the methods to retrieve

  • Returns The set of methods with the specified name from the given class.

  • Throws PodDefinitionValidationException if the specified method name is not found in the given class.

  • Example

final methods = ClassUtils.findMethodCandidatesByName(Class.of<UserService>(), 'configure');

Implementation

static Set<Method> findMethodCandidatesByName(Class clazz, String methodName) {
  Set<Method> candidates = HashSet();
		final methods = clazz.getMethods();
		for (Method method in methods) {
			if (methodName.equals(method.getName())) {
				candidates.add(method);
			}
		}
		return candidates;
}