Class AbstractGenerator

java.lang.Object
org.tentackle.buildsupport.codegen.AbstractGenerator

public abstract class AbstractGenerator extends Object
Base class for FreeMarker-based code generators.

Holds the template directory and creates a FreeMarker Configuration with the settings shared by all Tentackle generators. Used by the build-time plugins (e.g. the SQL, wizard and jlink Maven plugins).

  • Constructor Details

    • AbstractGenerator

      public AbstractGenerator()
  • Method Details

    • getTemplateDirectory

      public File getTemplateDirectory()
      Gets the FreeMarker template directory.
      Returns:
      the template directory
    • setTemplateDirectory

      public void setTemplateDirectory(File templateDirectory)
      Sets the FreeMarker template directory.
      Parameters:
      templateDirectory - the template directory, null if templates are loaded otherwise
    • createFreemarkerConfiguration

      public freemarker.template.Configuration createFreemarkerConfiguration() throws IOException
      Creates the FreeMarker configuration.

      The configuration loads the templates from the template directory (if set), reads them as UTF-8 and rethrows template exceptions instead of logging them, wrapping unchecked exceptions.

      Returns:
      the config
      Throws:
      IOException - if there's some trouble with the template directory