getMethodOrNull static method

Method? getMethodOrNull(
  1. Class clazz,
  2. String methodName,
  3. List<Class> paramTypes
)

Retrieves the method with the specified name and parameter types from the given class.

  • Parameters clazz: the class to analyze for method methodName: the name of the method to retrieve paramTypes: the parameter types of the method to retrieve

  • Returns The method with the specified name and parameter types from the given class.

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

  • Example

final method = ClassUtils.getMethodOrNull(Class.of<UserService>(), 'configure', [Class.of<String>()]);

Implementation

static Method? getMethodOrNull(Class clazz, String methodName, List<Class> paramTypes) {
  return clazz.getMethodBySignature(methodName, paramTypes);
}