code: public void generate(GeneratorOutput genOut) throws CodeGenerationException
      {
          //
          // Create a new VelocityContext
          //
          VelocityContext vc = new VelocityContext();
  
          //
          // Transfer any code generation properties excepted by the templates into the context
          // 
          HashMap<String,Object> genContext = genOut.getContext();
          for(String key : genContext.keySet())
              vc.put(key, genContext.get(key));
  
          try
          {
              Writer genWriter = genOut.getWriter();
              Template template = getTemplate(genOut.getTemplateName());
              template.merge(vc, genWriter);    
              genWriter.close();
          }
          // never wrap RuntimeException
          catch (RuntimeException re) {
              throw re;
          }
          catch (Exception e) {
              throw new CodeGenerationException(e);
          }
      }
docs: Implementation of the CodeGenerator.generate() method, using standard Velocity
  package naming conventions and the system class loader