public static @Nullable PsiClass createClassFromCustomTemplate(@Nullable PsiDirectory classDirectory,
                                                                 final @Nullable Module module,
                                                                 final String className,
                                                                 final String templateName) {
    if (classDirectory == null && module != null) {
      try {
        classDirectory = PackageUtil.findOrCreateDirectoryForPackage(module, "", null, false);
      }
      catch (IncorrectOperationException e) {
        return null;
      }
    }
    if (classDirectory == null) {
      return null;
    }
    try {
      final Properties properties =                                  FileTemplateManager.getInstance(classDirectory.getProject()).getDefaultProperties();
      return createClassNamed(className, new Properties(properties), templateName, classDirectory);
    }
    catch (IncorrectOperationException e) {
      LOG.error(e);
      return null;
    }
  }
public static @Nullable PsiClass createClassFromCustomTemplate(@Nullable PsiDirectory classDirectory,
                                                                 final @Nullable Module module,
                                                                 final String className,
                                                                 final String templateName)