protected function generateAst($realClass, $hydratorClass)
    {
        $originalClass = new \ReflectionClass($realClass);
        $builder = new ClassBuilder;
        $traverser = new NodeTraverser;

        $ast = $builder->fromReflection($originalClass);

        // Remove unused methods
        $traverser->addVisitor(new MethodDisablerVisitor(function() { return false; }));

        // Implement new methods and interfaces, extend original class
        $this->addMethodVisitors($originalClass, $traverser);
        $traverser->addVisitor(new ClassExtensionVisitor($realClass, $realClass));
        $traverser->addVisitor(new ClassImplementorVisitor($realClass, ['Indigo\\Hydra\\Hydrator']));

        // Renames class
        $traverser->addVisitor(new ClassRenamerVisitor($originalClass, $hydratorClass));

        return $traverser->traverse($ast);
    }