Finds the named controller method.

@param controllerClass
@param name
@return the controller method or null
177516
protected Method findMethod(Class<?> controllerClass, String name) {
        // identify first method which matches the name
        Method controllerMethod = null;
        for (Method method : controllerClass.getMethods()) {
            if (method.getName().equals(name)) {
                if (controllerMethod == null) {
                    controllerMethod = method;
                } else {
                    throw new FatalException("Found overloaded controller method '{}'. Method names must be unique!",
                            Util.toString(method));
                }
            }
        }

        return controllerMethod;
    }
1089765
public function controller($controller_name)
    {
        // Retrieving the class and method to launch.
        if (is_null($controller_name)) {
            return null;
        }

        $parts = preg_split('/::|@/', $controller_name);

        if (count($parts) == 1) {
            $parts[1] = '__invoke';
        }

        list($class, $method) = $parts;

        if (!class_exists($class, true)) {
            $class = sprintf('%s\\%s', $this->namespaces['controller'], ucfirst($class));
        }

        $injections = $this->injector($class, $method);

        return [
            'action' => [new $class(), $method],
            'injection' => $injections
        ];
    }
887316
def get_action_handler(self, controller_name, action_name):
        
        try_actions = [
            controller_name + '/' + action_name,
            controller_name + '/not_found',
            # call Index controller to catch all unhandled pages
            'index/not_found'
        ]
        # search first appropriate action handler
        for path in try_actions:
            if path in self._controllers:
                return self._controllers[path]
        return None
492546
public Method getGetter(String name) throws NoSuchMethodException {
        Method method = getterMethods.get(name);
        if (method == null) {
            throw new NoSuchMethodException("There is no READABLE property named '" + name +
                    "' in class '" + className + "'");
        }
        return method;
    }
1332552
@Override
	protected Class<?> findClass(final String name) throws ClassNotFoundException {
		log.trace("findClass:" + name);
		Class<?> clazz = findLoadedClass(name);
		if (clazz != null) {
			return clazz;
		}
		return super.findClass(name);
	}
876526
public final List<MethodInfo> getMethods(String name) {
    List<MethodInfo> namedMethod = methods.get(name);
    if (null == namedMethod) return Collections.emptyList();
    else return namedMethod;
  }
77846
public function loadMetadataForAction($controllerClassName, $actionMethod)
    {
        $key = $controllerClassName . '_' . $actionMethod;
        if (array_key_exists($key, $this->classAnnotations)) {
            return $this->classAnnotations[$key];
        }

        $r = new \ReflectionClass($controllerClassName);
        $rMethod = $r->getMethod($actionMethod);

        $metadata = new Metadata();


        /** @var Annotation\WorkflowDispatch|null $workflowDispatchAnnotation */
        $workflowDispatchAnnotation = $this->getReader()->getMethodAnnotation($rMethod, Annotation\WorkflowDispatch::class);
        if (null !== $workflowDispatchAnnotation) {
            $metadata->setWorkflowDispatch($workflowDispatchAnnotation->enabled);
            $metadata->setWorkflowRunType($workflowDispatchAnnotation->activity);
        }

        /** @var Annotation\PrepareData|null $prepareDataAnnotation */
        $prepareDataAnnotation = $this->getReader()->getMethodAnnotation($rMethod, Annotation\PrepareData::class);
        if ($prepareDataAnnotation) {
            $metadata->setFlagRunPrepareData($prepareDataAnnotation->enabled);
            $metadata->setPrepareDataMethod($prepareDataAnnotation->type);
            $metadata->setPrepareDataHandler($prepareDataAnnotation->handler);
        }


        /** @var Annotation\DispatchConditions|null $dispatchConditionsAnnotation */
        $dispatchConditionsAnnotation = $this->getReader()->getMethodAnnotation($rMethod, Annotation\DispatchConditions::class);
        if ($dispatchConditionsAnnotation && is_array($dispatchConditionsAnnotation->conditions) && count($dispatchConditionsAnnotation->conditions) > 0) {
            $metadata->setFlagHasConditions(true);
            foreach ($dispatchConditionsAnnotation->conditions as $condition) {
                if (!$condition instanceof Condition) {
                    $errMsg = 'Invalid condition annotation';
                    throw new Exception\AnnotationReaderException($errMsg);
                }
                $conditionMetadata = new DispatchConditionMetadata($condition->type, $condition->handler, $condition->params);

                $metadata->addConditions($conditionMetadata);
            }
        }
//
//        /** @var Annotation\WorkflowRouterMap|null $workflowRouterMapAnnotation */
//        $workflowRouterMapAnnotation = $this->getReader()->getMethodAnnotation($rMethod, Annotation\WorkflowRouterMap::class);
//        if ($workflowRouterMapAnnotation) {
//            $metadata->setWorkflowManagerNameRouterParam($workflowRouterMapAnnotation->managerName);
//            $metadata->setWorkflowActionNameRouterParam($workflowRouterMapAnnotation->actionName);
//            $metadata->setWorkflowNameRouterParam($workflowRouterMapAnnotation->name);
//            $metadata->setEntryIdRouterParam($workflowRouterMapAnnotation->entryId);
//        }
//
//        $metadata->validate();

        return $metadata;
    }
1302792
public MethodNode getMethod(String name, Parameter[] parameters) {
        for (MethodNode method : getMethods(name)) {
            if (parametersEqual(method.getParameters(), parameters)) {
                return method;
            }
        }
        return null;
    }
1094809
public final SgClass findClassByName(final String name) {
        if (name == null) {
            throw new IllegalArgumentException("The argument 'name' cannot be null!");
        }
        for (int i = 0; i < classes.size(); i++) {
            final SgClass clasz = classes.get(i);
            if (clasz.getName().equals(name)) {
                return clasz;
            }
        }
        return null;
    }
854352
public static Method findMethod(Class<?> clazz, String name) {
		for (Method me : clazz.getDeclaredMethods()) {
			if (me.getName().equalsIgnoreCase(name)) {
				return me;
			}
		}
		if (clazz.getSuperclass() != null) {
			return findMethod(clazz.getSuperclass(), name);
		}
		return null;
	}
1138700
public BshMethod getMethod(final String name, final Class<?>[] sig)
            throws UtilEvalError {
        return this.getMethod(name, sig, false/* declaredOnly */);
    }
973453
public function setController($controller, $name = null)
    {
        $controller = $this->app->normalizeClassName($controller, 'Controller');

        return $this->add($controller, $name);
    }
87773
public function controller($name)
	{
		if(isset($this->_controllers[$name]) && ($controller = $this->_controllers[$name]))
		{
			$name = is_callable($controller)
				? new CallbackController($controller)
				: $controller
				;

			if(is_object($name))
				return $name;
		}

		if($this->_resolver)
			return $this->_resolver->resolve($name);

		throw new LookupException("No controller defined for route '$name'");
	}
458894
@Override
   @SuppressWarnings("rawtypes")
   protected Class<?> findClass(String name) throws ClassNotFoundException {
      if (classCache.containsKey(name)) {
         return classCache.get(name);
      }

      for (WeakReference<Bundle> ref : bundles) {
         final Bundle bundle = ref.get();
         // ISPN-4679 may get a null handle from the weak reference
         if (bundle == null) continue;
         if (bundle.getState() == Bundle.ACTIVE) {
            try {
               final Class clazz = bundle.loadClass(name);
               if (clazz != null) {
                  classCache.put(name, clazz);
                  return clazz;
               }
            } catch (Exception ignore) {
            }
         }
      }

      throw new ClassNotFoundException("Could not load requested class : " + name);
   }
1066918
private Map<Method, Class<? extends Annotation>> getControllerMethods(Class<? extends Controller> controllerClass) {
        // collect the annotated methods
        Map<Method, Class<? extends Annotation>> controllerMethods = new LinkedHashMap<>();

        // discover all annotated controllers methods
        for (Method method : ClassUtils.getDeclaredMethods(controllerClass)) {
            for (Annotation annotation : method.getAnnotations()) {
                Class<? extends Annotation> annotationClass = annotation.annotationType();
                if (httpMethodAnnotationClasses.contains(annotationClass)) {
                    controllerMethods.put(method, annotationClass);
                    break;
                }
            }
        }

        return controllerMethods;
    }
376566
public List<MethodNode> getMethods(String name) {
        List<MethodNode> answer = new ArrayList<MethodNode>();
        ClassNode node = this;
        while (node != null) {
            answer.addAll(node.getDeclaredMethods(name));
            node = node.getSuperClass();
        }
        return answer;
    }
1343492
protected Map<Method, Class<? extends Annotation>> discoverMethods(Collection<Class<?>> classes) {
        // collect the allowed annotated methods
        Map<Method, Class<? extends Annotation>> discoveredMethods = new LinkedHashMap<>();

        // discover all annotated controllers and methods
        for (Class<?> controllerClass : classes) {
            for (Method method : controllerClass.getDeclaredMethods()) {
                if (RequireUtil.allowMethod(settings, method)) {
                    for (Annotation annotation : method.getAnnotations()) {
                        Class<? extends Annotation> annotationClass = annotation.annotationType();
                        if (httpMethodAnnotationClasses.contains(annotationClass)) {
                            discoveredMethods.put(method, annotationClass);
                            break;
                        }
                    }
                }
            }
        }

        return discoveredMethods;
    }