def register_as_type(self, locator, object_factory):
        """
        Registers a component using its type (a constructor function).

        :param locator: a locator to identify component to be created.

        :param object_factory: a component type.
        """
        if locator == None:
            raise Exception("Locator cannot be null")
        if object_factory == None:
            raise Exception("Factory cannot be null")

        def factory(locator):
            return object_factory()

        self._registrations.append(Registration(locator, factory))