Class GeneratorSetup

java.lang.Object
de.monticore.generating.GeneratorSetup

public class GeneratorSetup extends Object
Setup for generator (see GeneratorEngine).
  • Field Details

    • outputDirectory

      protected File outputDirectory
      Where to store all files (e.g. "gen" or "out")
    • glex

      protected GlobalExtensionManagement glex
      Used for handling variables and hook points; Default is only created with first get-access.
    • handcodedPath

      protected MCPath handcodedPath
      The path for the handwritten code Default is only created with first get-access.
    • additionalTemplatePaths

      protected List<File> additionalTemplatePaths
      Additional path as the source of templates
    • tracing

      protected boolean tracing
      Defines if tracing infos are added to the result as comments
    • commentStart

      protected String commentStart
      The characters for the start of a comment. Usually these are the comments of the target language.
    • commentEnd

      protected String commentEnd
      The characters for the end of a comment. Usually these are the comments of the target language.
    • modelName

      protected Optional<String> modelName
      The model name (if the arftifacts are generated from one model, this could be an identifier of this model) By default the model name is absent -- and then the according tracing info is not printed at all.
    • freeMarkerTemplateEngine

      protected FreeMarkerTemplateEngine freeMarkerTemplateEngine
      The real engine provided by FreeMarker
    • defaultFileExtension

      protected String defaultFileExtension
      Desired default file extension, e.g. "java"
    • GENERATED_CLASS_SUFFIX

      public static final String GENERATED_CLASS_SUFFIX
      Additional Suffix for a generated Class, if the class itself already exists.
      See Also:
    • FREEMARKER_VERSION

      public static final freemarker.template.Version FREEMARKER_VERSION
    • aliases

      protected List<Alias> aliases
      A list of all freemarker functions that serve as aliases for Java methods, e.g. 'include' as alias for 'tc.include'
    • ALIASES_TEMPLATE

      public static final String ALIASES_TEMPLATE
      See Also:
  • Constructor Details

    • GeneratorSetup

      public GeneratorSetup()
      Constructor
  • Method Details

    • getConfig

      public freemarker.template.Configuration getConfig()
    • setDefaultFileExtension

      public void setDefaultFileExtension(String o)
      Sets the default file extension used for the generated files, e.g. java or .java (with leading dot).
      Parameters:
      o - the file extension, e.g. java or .java (with leading dot)
    • getDefaultFileExtension

      public String getDefaultFileExtension()
    • setFileHandler

      public void setFileHandler(FileReaderWriter o)
    • setFreeMarkerTemplateEngine

      public void setFreeMarkerTemplateEngine(FreeMarkerTemplateEngine o)
    • getFreeMarkerTemplateEngine

      public FreeMarkerTemplateEngine getFreeMarkerTemplateEngine()
    • setOutputDirectory

      public void setOutputDirectory(File outputDirectory)
    • getOutputDirectory

      public File getOutputDirectory()
    • getClassLoader

      protected ClassLoader getClassLoader()
    • setGlex

      public void setGlex(GlobalExtensionManagement glex)
    • getGlex

      public GlobalExtensionManagement getGlex()
    • setAdditionalTemplatePaths

      public void setAdditionalTemplatePaths(List<File> additionalTemplatePaths)
    • getAdditionalTemplatePaths

      public List<File> getAdditionalTemplatePaths()
    • getHandcodedPath

      public MCPath getHandcodedPath()
      Returns:
      targetPath
    • setHandcodedPath

      public void setHandcodedPath(MCPath hwcPath)
      Parameters:
      hwcPath - the handcoded path to set
    • setTracing

      public void setTracing(boolean tracing)
      Parameters:
      tracing - defines if tracing infos are added to the result as comments.
    • isTracing

      public boolean isTracing()
      Returns:
      true, if tracing infos are added to the result as comments.
    • getCommentStart

      public String getCommentStart()
      Returns:
      the characters for the start of a comment. Usually same as the target language.
    • setCommentStart

      public void setCommentStart(String commentStart)
      Parameters:
      commentStart - the characters for the start of a comment. Usually same as the target language.
    • getCommentEnd

      public String getCommentEnd()
      Returns:
      the characters for the end of a comment. Usually same as the target language.
    • setCommentEnd

      public void setCommentEnd(String commentEnd)
      Parameters:
      commentEnd - the characters for the end of a comment. Usually same as the target language.
    • getModelName

      public Optional<String> getModelName()
      Returns:
      modelName
    • setModelName

      public void setModelName(String modelName)
      Parameters:
      modelName - the modelName to set
    • getAliases

      public List<Alias> getAliases()
      Returns:
      the aliases
    • setAliases

      public void setAliases(List<Alias> aliases)
      Parameters:
      aliases - the aliases to set
    • addAlias

      public void addAlias(Alias alias)
    • getNewTemplateController

      public TemplateController getNewTemplateController(String templateName)
      This is the Method that creates TemplateControllers (it is used afresh for each template that is called) HotSPOT: If a different Template Controller shall be used then override this method in a subclass