MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / getMethod

Method getMethod

java/src/org/openqa/selenium/json/JsonOutput.java:556–571  ·  view source on GitHub ↗

Get a reference to a method of the specified name with no argument in the indicated class or one of its ancestors. @param clazz target Java class @param methodName method name @return Method object with 'accessible' flag set @throws JsonException if a security violation is encountered

(Class<?> clazz, String methodName)

Source from the content-addressed store, hash-verified

554 * @throws JsonException if a security violation is encountered
555 */
556 private static @Nullable Method getMethod(Class<?> clazz, String methodName) {
557 if (Object.class.equals(clazz)) {
558 return null;
559 }
560
561 try {
562 Method method = clazz.getDeclaredMethod(methodName);
563 method.setAccessible(true);
564 return method;
565 } catch (NoSuchMethodException e) {
566 return getMethod(clazz.getSuperclass(), methodName);
567 } catch (SecurityException e) {
568 throw new JsonException(
569 "Unable to find the method because of a security constraint: " + methodName, e);
570 }
571 }
572
573 /**
574 * Convert the specified Java object using the indicated zero-argument method of this object.

Callers 1

resolveConverterMethod · 0.95

Calls 1

equalsMethod · 0.45

Tested by

no test coverage detected