Binds a new controller.

@param controller the controller
336614
@Bind(aggregate = true, optional = true)
    public synchronized void bindController(Controller controller) {
        LOGGER.info("Adding routes from " + controller);

        List<Route> newRoutes = new ArrayList<>();
        try {

            List<Route> annotatedNewRoutes = RouteUtils.collectRouteFromControllerAnnotations(controller);
            newRoutes.addAll(annotatedNewRoutes);
            newRoutes.addAll(controller.routes());

            //check if these new routes don't pre-exist
            ensureNoConflicts(newRoutes);

        } catch (RoutingException e) {
            LOGGER.error("The controller {} declares routes conflicting with existing routes, " +
                    "the controller is ignored, reason: {}", controller, e.getMessage(), e);
            // remove all new routes as one has failed
            routes.removeAll(newRoutes);  //NOSONAR
        } catch (Exception e) {
            LOGGER.error("The controller {} declares invalid routes, " +
                    "the controller is ignored, reason: {}", controller, e.getMessage(), e);
            // remove all new routes as one has failed
            routes.removeAll(newRoutes); //NOSONAR
        }
    }
1131549
@Override
	public ControllerLinkBuilder linkTo(Class<?> controller, Map<String, ?> parameters) {
		return ControllerLinkBuilder.linkTo(controller, parameters);
	}
1322448
public void add(Binding binding) {
	if (values == null) values = new LinkedList();
	values.add(binding);
    }
944488
@Override
    public void visit(ClassOrInterfaceDeclaration declaration, ControllerModel controller) {
        controller.setName(declaration.getName());

        LOGGER.info("[controller]Visit " + controller.getName());
        //Go on with the methods and annotations
        super.visit(declaration,controller);
    }
1298856
public void addControllerListener(ControllerListener<? super INFO> controllerListener) {
    Preconditions.checkNotNull(controllerListener);
    if (mControllerListener instanceof InternalForwardingListener) {
      ((InternalForwardingListener<INFO>) mControllerListener).addListener(controllerListener);
      return;
    }
    if (mControllerListener != null) {
      mControllerListener = InternalForwardingListener.createInternal(
          mControllerListener,
          controllerListener);
      return;
    }
    // Listener only receives <INFO>, it never produces one.
    // That means if it can accept <? super INFO>, it can very well accept <INFO>.
    mControllerListener = (ControllerListener<INFO>) controllerListener;
  }
315885
public function setController(Controller $controller)
    {
        $this->links->controller = $controller;
        $this->twig->addGlobal('controller', $this->links->controller);
    }
973453
public function setController($controller, $name = null)
    {
        $controller = $this->app->normalizeClassName($controller, 'Controller');

        return $this->add($controller, $name);
    }
707076
public HandlerRegistration addController(final I_CmsDNDController controller) {

        m_controllers.add(controller);
        return new HandlerRegistration() {

            public void removeHandler() {

                m_controllers.remove(controller);
            }
        };
    }
1100477
protected void maybeBuildAndSetGestureDetector(AbstractDraweeController controller) {
    GestureDetector gestureDetector = controller.getGestureDetector();
    if (gestureDetector == null) {
      gestureDetector = GestureDetector.newInstance(mContext);
      controller.setGestureDetector(gestureDetector);
    }
  }
734603
public void setBinding(String binding) throws JspException
    {
        if (!isValueReference(binding))
        {
            throw new IllegalArgumentException("not a valid binding: " + binding);
        }
        _binding = binding;
    }
647327
public void addRouter(final Class<?> routeType, Object controller) {

        Method[] methods = routeType.getDeclaredMethods();
        if (BladeKit.isEmpty(methods)) {
            return;
        }

        String nameSpace = null, suffix = null;
        if (null != routeType.getAnnotation(Path.class)) {
            nameSpace = routeType.getAnnotation(Path.class).value();
            suffix = routeType.getAnnotation(Path.class).suffix();
        }

        if (null == nameSpace) {
            log.warn("Route [{}] not path annotation", routeType.getName());
            return;
        }

        for (Method method : methods) {

            com.blade.mvc.annotation.Route mapping     = method.getAnnotation(com.blade.mvc.annotation.Route.class);
            GetRoute                       getRoute    = method.getAnnotation(GetRoute.class);
            PostRoute                      postRoute   = method.getAnnotation(PostRoute.class);
            PutRoute                       putRoute    = method.getAnnotation(PutRoute.class);
            DeleteRoute                    deleteRoute = method.getAnnotation(DeleteRoute.class);

            this.parseRoute(RouteStruct.builder().mapping(mapping)
                    .getRoute(getRoute).postRoute(postRoute)
                    .putRoute(putRoute).deleteRoute(deleteRoute)
                    .nameSpace(nameSpace)
                    .suffix(suffix).routeType(routeType)
                    .controller(controller).method(method)
                    .build());
        }
    }
826801
public function initController($controller, $path)
    {
        if($path)
        {
            $controller = $this->name . '\\Controller\\' . $path . '\\' . $controller;
        }
        else
        {
            $controller = $this->name . '\\Controller\\' . $controller;
        }

        return new $controller();
    }
340972
public function initialize(Controller $controller) {
		$this->_controller = $controller;
		if (!$this->_controller->Components->loaded('RequestHandler')) {
			$this->_controller->RequestHandler = $this->_controller->Components->load('RequestHandler');
			$this->_controller->RequestHandler->initialize($this->_controller);
		}
	}
637144
private function initialize(AbstractController $controller)
    {
        foreach ($this->initializers as $initializer) {
            if ($initializer instanceof InitializerInterface) {
                $initializer->initialize($controller, $this);
            } else {
                call_user_func($initializer, $controller, $this);
            }
        }
    }
101238
public function setController($name, $controller=null)
	{
	    if ($name instanceof Controller) {
	        $controller = $name;
	        $sname = $controller->getName();
	    } elseif ($controller instanceof Controller) {
	        $sname = $name && !is_numeric($name) ? $name : $controller->getName();
	    } else {
	        if ($controller) {
	            $class_name = Ioc::findClass($controller, 'controller');
	        } else {
	            $class_name = Ioc::findClass($name, 'controller');
	        }
	        
	        if ($class_name && is_subclass_of($class_name, "\\Wslim\\Console\\Controller")) {
	            $sname = is_numeric($name) ? null : $name;
	            $controller =  new $class_name($sname);
	            if (!$sname) {
	                $sname = $controller->getName();
	            }
	        } else {
	            throw new \LogicException(sprintf('Controller class "%s" is not exists.', $controller));
	        }
	    }
	    
	    if (!$controller->isEnabled()) {
	        return;
	    }
	    
	    if (null === $controller->getDefinition()) {
	        throw new \LogicException(sprintf('Controller class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($controller)));
	    }
	    
	    $this->controllers[$sname] = $controller;
	    
	    foreach ($controller->getAliases() as $alias) {
	        $this->controllers[$alias] = $controller;
	    }
	    
	    return $controller;
	}
226747
@Override
  public void bind()
  {
    if (_ownerProvider == null) {
      _ownerBinding.bind();
      
      _ownerProvider = _ownerBinding.provider(); 

      _program = _manager.program(_method.getParameters());
    }
  }
296784
def add_controller(self, controller, timeout=None):
        # type: (Controller, float) -> None
        
        assert controller.mri not in self._controllers, \
            "Controller already exists for %s" % controller.mri
        self._controllers[controller.mri] = controller
        controller.setup(self)
        if self.state:
            should_publish = self._start_controllers([controller], timeout)
            if self.state == STARTED and should_publish:
                self._publish_controllers(timeout)