public function getGenerator($component_type, $component_data) {
    $class = $this->getGeneratorClass($component_type);

    if (!class_exists($class)) {
      throw new \DrupalCodeBuilder\Exception\InvalidInputException(strtr("Invalid component type !type.", array(
        '!type' => htmlspecialchars($component_type, ENT_QUOTES, 'UTF-8'),
      )));
    }

    $generator = new $class($component_data);

    // Quick hack for the benefit of the Hooks generator.
    $generator->classHandlerHelper = $this;

    return $generator;
  }