code: public final SourceWriter getSourceWriter(final JClassType pclassType,
        final GeneratorContext pcontext, final TreeLogger plogger) {
      final String packageName = pclassType.getPackage().getName();
      final String simpleName = pclassType.getSimpleSourceName() + "Generated";
      final ClassSourceFileComposerFactory composer =
          new ClassSourceFileComposerFactory(packageName, simpleName);
      composer.setSuperclass(pclassType.getName());
  
      // Need to add whatever imports your generated class needs.
      composer.addImport("com.google.gwt.safehtml.shared.SafeHtml");
      composer.addImport("com.google.gwt.safehtml.shared.SafeHtmlUtils");
  
      final PrintWriter printWriter = pcontext.tryCreate(plogger, packageName, simpleName);
      if (printWriter == null) {
        return null;
      }
      return composer.createSourceWriter(pcontext, printWriter);
    }
docs: get source writer for the generator.
  
  @param pclassType class type
  @param pcontext generator context
  @param plogger tree logger
  @return SourceWriter to write the generated sources to