Register data-type handler

@param DataTypeHandlerInterface $handler
554391
public function registerDataTypeHandler(DataTypeHandlerInterface $handler)
    {
        foreach ($handler->supports() as $name) {
            $this->handlers[$name] = $handler;
        }
    }
195565
public function register($type, $handler) {
        if ( ! is_array($type)) {
            $type = [$type];
        }

        foreach ($type as $item) {
            $this->addDefinition(
                $this->createDefinition($item, $handler)
            );
        }

        return $this;
    }
119292
public function setErrorHandler(callable $handler, $types = 'use-php-defaults')
    {
        // Workaround for PHP 5.5
        if ($types === 'use-php-defaults') {
            $types = E_ALL | E_STRICT;
        }
        #set_error_handler([$this, 'onError'], error_reporting());
        return set_error_handler($handler, $types);
    }
1360163
public function setHandler($handler)
    {
        $handler = new $handler($this->config);

        if (!$handler instanceof HandlerInterface) {
            throw new \RuntimeException('Handler not initialized. Please use Handler class instanceof HandlerInterface.');
        }

        $this->handler = $handler;

        return $this;
    }
823548
def register_lookup_handler(lookup_type, handler_or_path):
    
    handler = handler_or_path
    if isinstance(handler_or_path, basestring):
        handler = load_object_from_string(handler_or_path)
    LOOKUP_HANDLERS[lookup_type] = handler
    if type(handler) != type:
        # Hander is a not a new-style handler
        logger = logging.getLogger(__name__)
        logger.warning("Registering lookup `%s`: Please upgrade to use the "
                       "new style of Lookups." % lookup_type)
        warnings.warn(
            # For some reason, this does not show up...
            # Leaving it in anyway
            "Lookup `%s`: Please upgrade to use the new style of Lookups"
            "." % lookup_type,
            DeprecationWarning,
            stacklevel=2,
        )
929867
function registerType($typeIdentifier, \Plasma\Types\TypeExtensionInterface $type): void {
        if(isset($this->regularTypes[$typeIdentifier]) || isset($this->classTypes[$typeIdentifier])) {
            throw new \Plasma\Exception('Type identifier is already in use');
        }
        
        if(\in_array($typeIdentifier, static::PHP_TYPES, true)) {
            $this->regularTypes[$typeIdentifier] = $type;
        } else {
            $this->classTypes[$typeIdentifier] = $type;
        }
    }
810836
private function initHandler(SaveHandlerInterface $handler)
    {
        return session_set_save_handler(array($handler, 'open'), 
                                        array($handler, 'close'), 
                                        array($handler, 'read'), 
                                        array($handler, 'write'), 
                                        array($handler, 'destroy'), 
                                        array($handler, 'gc'));
    }
810358
private void addHandler(Object handler)
    {
        // Would be nice to have a better way to do this,
        // but the type information isn't preserved in the XML format anymore -
        // and the number of types of handler is pretty unlikely to change, so this list
        // won't have to be added to often, if at all.
        if (handler == null)
            return;

        if (handler instanceof IVideoProducer)
            addVideoProducer((IVideoProducer)handler);
        else if (handler instanceof IAudioProducer)
            addAudioProducer((IAudioProducer)handler);
        else if (handler instanceof ICommandHandler)
            addCommandHandler((ICommandHandler)handler);
        else if (handler instanceof IObservationProducer)
            addObservationProducer((IObservationProducer)handler);
        else if (handler instanceof IRewardProducer)
            addRewardProducer((IRewardProducer)handler);
        else if (handler instanceof IWorldGenerator)
            addWorldGenerator((IWorldGenerator)handler);
        else if (handler instanceof IWorldDecorator)
            addWorldDecorator((IWorldDecorator)handler);
        else if (handler instanceof IWantToQuit)
            addQuitProducer((IWantToQuit)handler);
        else
            this.failedHandlers += handler.getClass().getSimpleName() + " isn't of a recognised handler type.\n";
    }
422969
public void registerHardwareCapability(final RegisterHardwareCapabilityHandler handler){
        HMSAgentLog.i("registerHardwareCapability: handler=" + StrUtils.objDesc(handler));
        this.handler = handler;
        this.retryTimes = MAX_RETRY_TIMES;
        connect();
    }
60020
public function registerCommand(CommandInterface $commandHandler)
    {
        $command = strtoupper($commandHandler->getCommand());
        $this->commandHandlers[$command] = $commandHandler;
    }
240451
public static void registerInputStreamHandler(MimeType type, InputStreamHandler handler) {
        $.requireNotNull(handler);
        InputStreamHandlerDispatcher dispatcher = inputStreamHandlerLookup.get(type);
        if (null == dispatcher) {
            dispatcher = new InputStreamHandlerDispatcher(handler);
            inputStreamHandlerLookup.put(type, dispatcher);
        } else {
            dispatcher.add(handler);
        }
    }
1338272
public void registerArtefactHandler(ArtefactHandler handler) {
        GrailsApplicationAwareBeanPostProcessor.processAwareInterfaces(this, handler);
        artefactHandlersByName.put(handler.getType(), handler);
        updateArtefactHandlers();
    }
798118
public function use_default_handler( HandlerInterface $handler = NULL ) {

		static $done = FALSE;
		if ( $done ) {
			return $this;
		}

		$done = TRUE;

		add_action(
			HandlersRegistry::ACTION_REGISTER,
			function ( HandlersRegistry $registry ) use ( $handler ) {

				$handler = DefaultHandlerFactory::with_default_handler( $handler )
					->create_default_handler();

				$registry->add_handler( $handler, HandlersRegistry::DEFAULT_NAME );
			},
			1
		);

		return $this;
	}
1051820
public function addExceptionHandler($handler) {
        if ( ! $handler instanceof IExceptionHandler && ! is_callable($handler)) {
            throw new InvalidHandlerType(
                s('Exception handler must be a callable or an instance of %s.',
                    IExceptionHandler::class)
            );
        }

        if (is_callable($handler)) {
            $handler = $this->createExceptionHandler($handler);
        }

        $this->exceptionHandlers[] = $handler;
    }
366812
public function forType(string $type): HandlerInterface
    {
        if (!in_array($type, ['integer', 'float', 'integer|float', 'float|integer'])) {
            throw new LogicException("Unable to use " . get_class($this) . " to cast to $type");
        }

        if ($this->type === $type || ((strpos($this->type, '|') !== false && strpos($type, '|') !== false))) {
            return $this;
        }

        $handler = clone $this;
        $handler->type = $type;

        return $handler;
    }
533453
public void addHandler(AbstractHandler handler) {
    HandlerList handlers = new HandlerList();
    handlers.addHandler(handler);
    for (Handler h : mServer.getHandlers()) {
      handlers.addHandler(h);
    }
    mServer.setHandler(handlers);
  }
591114
public function attachEventListener($eventType,$handler) {
    if (!$eventType)
      $eventType = $this->getEventPrefix();
    elseif (!strstr($eventType,':') && $eventType != $this->getEventPrefix())
      $eventType = $this->getEventPrefix().':'.$eventType;
    
    return $this->_forceGetEventsManager()->attach($eventType,$handler);
  }