Finds method with name, throws exception if no method found or there are many of them.
345648
public static Method findMethod(Class clazz, String methodName) {
        final List<Method> methods = getDeclaredMethodsRecursively(clazz).get(methodName);
        if (methods.isEmpty()) {
            throw new IllegalArgumentException(clazz.getName() + "::" + methodName + " not found");
        }
        final List<Method> specificMethods;
        if (methods.size() > 1) {
            specificMethods
                = methods.stream().filter(m -> m.getReturnType() != Object.class).collect(Collectors.toList());
        } else {
            specificMethods = methods;
        }
        if (specificMethods.size() != 1) {
            throw new IllegalArgumentException(
                clazz.getName() + "::" + methodName
                + " more then one method found, can not decide which one to use. "
                + methods
            );
        }
        return specificMethods.get(0);
    }
1227607
public void executeMethods(final List<Method> methods) throws Exception {

        for (final Method method : methods) {

            // TODO - curious about the findSuitableInstancesOf ? won't
            // method.getDeclaringClass be ok??

            for (final Object object : findSuitableInstancesOf(method.getDeclaringClass())) {

                method.invoke(object);

            }
        }
    }
1311686
public static void throwExceptionIfMethodWasNotFound(Class<?> type, String methodName, Method methodToMock,
                                                         Object... arguments) {
        if (methodToMock == null) {
            String methodNameData = "";
            if (methodName != null) {
                methodNameData = "with name '" + methodName + "' ";
            }
            throw new MethodNotFoundException("No method found " + methodNameData + "with parameter types: [ "
                                                      + getArgumentTypesAsString(arguments) + " ] in class " + getOriginalUnmockedType(type)
                                                                                                                       .getName() + ".");
        }
    }
478108
public static Method findMethod(String name, Class<?> cls) {
    
    for(Method method : cls.getDeclaredMethods()) {
      if(method.getName().equals(name)) {
        return method;
      }
    }
    
    throw new ExecutionException("invalid auto-function: no '" + name + "' method declared", null);
  }
258589
function findMethod(source, nameExpr, data) {
    var method = source;

    for (var i = 0; method != null && i < nameExpr.paths.length; i++) {
        method = method[evalExpr(nameExpr.paths[i], data)];
    }

    return method;
}
591044
public final SgMethod findMethodByName(final String name) {
        if (name == null) {
            throw new IllegalArgumentException("The argument 'name' cannot be null!");
        }
        for (int i = 0; i < methods.size(); i++) {
            final SgMethod method = methods.get(i);
            if (method.getName().equals(name)) {
                return method;
            }
        }
        return null;
    }
275947
private Method method() throws DynamicGroundingBuildingException {
        Method[] methods = clas.getMethods();
        for (Method method : methods) {
            if (method.getName().equals(methodName)) {
                return method;
            }
        }
        throw new DynamicGroundingBuildingException("clas " + clas.getSimpleName()
                + " has no method with that name (" + methodName + ")");
    }
967224
public static Method findMethod(Class<?> type, String name,
			Class<?>... parameterTypes) {
		while (type != null) {
			try {
				return type.getDeclaredMethod(name, parameterTypes);
			} catch (Exception e) {
			}
			type = type.getSuperclass();
		}
		return null;
	}
1069089
private MethodConfig getMethodConfig(String methodName) {
        if (methods == null) {
            return null;
        }
        return methods.get(methodName);
    }
1280829
private static <T> List<Method> getMethods(Class<T> type, String... names) {

		Assert.notNull(type, "Missing class to search for methods!");
		Assert.notNullOrEmpty(names, "Missing method names to search for!");

		Map<String, Method> candidates = new HashMap<>();
		for (Method method : type.getMethods()) {

			if (Modifier.isStatic(method.getModifiers()) &&
			    method.getReturnType().equals(type) &&
			    method.getParameterTypes().length == 1 &&
			    method.getParameterTypes()[0].isAssignableFrom(String.class)) {

				candidates.put(method.getName(), method);
			}
		}

		List<Method> output = new ArrayList<>();

		// go in order desired
		for (String name : names) {
			if (candidates.containsKey(name)) {
				output.add(candidates.get(name));
			}
		}

		return output;
	}
876526
public final List<MethodInfo> getMethods(String name) {
    List<MethodInfo> namedMethod = methods.get(name);
    if (null == namedMethod) return Collections.emptyList();
    else return namedMethod;
  }
1035088
private Method findSetter(Method []methods, String getterName, Class< ? > arg) {
        String setterName = "set" + getterName.substring(INT_VALUE);
	    
        for (int i = 0; i < methods.length; i++) {
            Method method = methods[i];

            if (!method.getName().equals(setterName)) {
                continue;
            }
            
            if (!method.getReturnType().equals(void.class)) {
                continue;
            }

            Class< ? > []params = method.getParameterTypes();

            if (params.length == 1 && params[0].equals(arg)) {
                return method;
            }
        }
        return null;
    }
1336662
@GwtIncompatible("incompatible method")
    private static Throwable getCauseUsingMethodName(final Throwable throwable, final String methodName) {
        Method method = null;
        try {
            method = throwable.getClass().getMethod(methodName);
        } catch (final NoSuchMethodException | SecurityException ignored) { // NOPMD
            // exception ignored
        }

        if (method != null && Throwable.class.isAssignableFrom(method.getReturnType())) {
            try {
                return (Throwable) method.invoke(throwable);
            } catch (final IllegalAccessException | IllegalArgumentException | InvocationTargetException ignored) { // NOPMD
                // exception ignored
            }
        }
        return null;
    }
1171123
private boolean ignoreMethod(String name)
   {
      boolean result = false;

      for (String ignoredName : IGNORED_METHODS)
      {
         if (name.matches(ignoredName))
         {
            result = true;
            break;
         }
      }

      return result;
   }
740409
def recursively_find_methods_matching(name, is_class_method)
      res = local_methods_matching(name, is_class_method)
      @inferior_classes.each do |c|
        res.concat(c.recursively_find_methods_matching(name, is_class_method))
      end
      res
    end
48493
public SMethod findMethod(String methodName) {
		for (SService sService : servicesByName.values()) {
			SMethod method = sService.getSMethod(methodName);
			if (method != null) {
				return method;
			}
		}
		return null;
	}
554675
public final void methodName() throws RecognitionException {
		int methodName_StartIndex = input.index();

		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 128) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1230:5: ( Identifier | 'insert' | 'update' | 'modify' | 'retract' | 'delete' )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
			{
			if ( input.LA(1)==Identifier||input.LA(1)==75||input.LA(1)==90||input.LA(1)==95||input.LA(1)==103||input.LA(1)==117 ) {
				input.consume();
				state.errorRecovery=false;
				state.failed=false;
			}
			else {
				if (state.backtracking>0) {state.failed=true; return;}
				MismatchedSetException mse = new MismatchedSetException(null,input);
				throw mse;
			}
			}

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 128, methodName_StartIndex); }

		}
	}