getStaticMethod static method

Method? getStaticMethod(
  1. Class target,
  2. String methodName
)

Retrieves the static method with the specified name from the given class.

  • Parameters target: the class to analyze for static method methodName: the name of the static method to retrieve

  • Returns The static method with the specified name from the given class.

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

  • Example

final method = ClassUtils.getStaticMethod(Class.of<UserService>(), 'configure');

Implementation

static Method? getStaticMethod(Class target, String methodName) {
  Method? method = target.getMethod(methodName);
  if (method != null && method.isStatic()) {
    return method;
  }
  return null;
}