code: private void generateBeanInfo(ClassDoc classDoc) throws Exception {
  
          String beanInfoJavaFileName =
              classDoc.getTypeNameForFile() + "BeanInfo.java";
  
          String beanInfoJavaFilePath = beanInfoJavaFileName;
  
          String packageName = classDoc.getPackageName();
  
          if (packageName != null) {
              // Create the file path using the package
              beanInfoJavaFilePath =
                  packageName.replace('.', '/') + "/" + beanInfoJavaFileName;
          }
  
          File dest = null;
  
          if (mDest != null) {
              dest = new File(mDest, beanInfoJavaFilePath);
          }
          else {
              dest = new File(beanInfoJavaFilePath);
          }
  
          if (dest.exists()) {
              if (dest.canWrite()) {
                  //printWarning("File exists: " + beanInfoJavaFileName);
              }
              else {
                  // Attempt to overwrite the file via delete
                  if (dest.delete()) {
                      //printWarning("File exists: " + beanInfoJavaFileName);
  
                  }
                  else {
                      printWarning("File exists and cannot be written: " +
                                   beanInfoJavaFileName);
                      return;
                  }
              }
          }
  
          BeanDocContext context = null;
          try {
  
              context = new BeanDocContext(this, dest);
  
              if (mTemplate != null) {
                  printNotice("Creating BeanInfo: " + beanInfoJavaFilePath);
                  mTemplate.execute(context, new Object[] { classDoc });
              }
              else {
                  printWarning("No template");
              }
          }
          finally {
              if (context != null) {
                  context.close();
              }
          }
      }
docs: Using a Tea template, generates a "BeanInfo.java" file for the
  specified ClassDoc.