MCPcopy Index your code
hub / github.com/apache/tomcat / findMethod

Method findMethod

java/jakarta/el/Util.java:92–121  ·  view source on GitHub ↗
(ELContext context, Class<?> clazz, Object base, String methodName, Class<?>[] paramTypes,
            Object[] paramValues)

Source from the content-addressed store, hash-verified

90 * This method duplicates code in org.apache.el.util.ReflectionUtil. When making changes keep the code in sync.
91 */
92 static Method findMethod(ELContext context, Class<?> clazz, Object base, String methodName, Class<?>[] paramTypes,
93 Object[] paramValues) {
94
95 if (clazz == null || methodName == null) {
96 throw new MethodNotFoundException(
97 message(null, "util.method.notfound", clazz, methodName, paramString(paramTypes)));
98 }
99
100 if (paramTypes == null) {
101 paramTypes = getTypesFromValues(paramValues);
102 }
103
104 // Fast path: when no arguments exist, there can only be one matching method and no need for coercion.
105 if (paramTypes.length == 0) {
106 try {
107 Method method = clazz.getMethod(methodName, paramTypes);
108 return getMethod(clazz, base, method);
109 } catch (NoSuchMethodException | SecurityException ignore) {
110 // Fall through to broader, slower logic
111 }
112 }
113
114 Method[] methods = clazz.getMethods();
115
116 List<Wrapper<Method>> wrappers = Wrapper.wrap(methods, methodName);
117
118 Wrapper<Method> result = findWrapper(context, clazz, wrappers, methodName, paramTypes, paramValues);
119
120 return getMethod(clazz, base, result.unWrap());
121 }
122
123 /*
124 * This method duplicates code in org.apache.el.util.ReflectionUtil. When making changes keep the code in sync.

Callers 2

invokeMethod · 0.95
invokeMethod · 0.95

Calls 8

messageMethod · 0.95
paramStringMethod · 0.95
getTypesFromValuesMethod · 0.95
getMethodMethod · 0.95
wrapMethod · 0.95
findWrapperMethod · 0.95
getMethodMethod · 0.65
unWrapMethod · 0.45

Tested by

no test coverage detected