Package de.monticore.generating
Class GeneratorSetup
java.lang.Object
de.monticore.generating.GeneratorSetup
Setup for generator (see
GeneratorEngine).-
Field Summary
FieldsModifier and TypeFieldDescriptionAdditional path as the source of templatesA list of all freemarker functions that serve as aliases for Java methods, e.g.static final Stringprotected StringThe characters for the end of a comment.protected StringThe characters for the start of a comment.protected StringDesired default file extension, e.g.static final freemarker.template.Versionprotected FreeMarkerTemplateEngineThe real engine provided by FreeMarkerstatic final StringAdditional Suffix for a generated Class, if the class itself already exists.protected GlobalExtensionManagementUsed for handling variables and hook points; Default is only created with first get-access.protected MCPathThe path for the handwritten code Default is only created with first get-access.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.protected FileWhere to store all files (e.g.protected booleanDefines if tracing infos are added to the result as comments -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected ClassLoaderfreemarker.template.ConfigurationgetGlex()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 subclassbooleanvoidsetAdditionalTemplatePaths(List<File> additionalTemplatePaths) voidsetAliases(List<Alias> aliases) voidsetCommentEnd(String commentEnd) voidsetCommentStart(String commentStart) voidSets the default file extension used for the generated files, e.g.voidvoidvoidvoidsetHandcodedPath(MCPath hwcPath) voidsetModelName(String modelName) voidsetOutputDirectory(File outputDirectory) voidsetTracing(boolean tracing)
-
Field Details
-
outputDirectory
Where to store all files (e.g. "gen" or "out") -
glex
Used for handling variables and hook points; Default is only created with first get-access. -
handcodedPath
The path for the handwritten code Default is only created with first get-access. -
additionalTemplatePaths
Additional path as the source of templates -
tracing
protected boolean tracingDefines if tracing infos are added to the result as comments -
commentStart
The characters for the start of a comment. Usually these are the comments of the target language. -
commentEnd
The characters for the end of a comment. Usually these are the comments of the target language. -
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
The real engine provided by FreeMarker -
defaultFileExtension
Desired default file extension, e.g. "java" -
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
A list of all freemarker functions that serve as aliases for Java methods, e.g. 'include' as alias for 'tc.include' -
ALIASES_TEMPLATE
- See Also:
-
-
Constructor Details
-
GeneratorSetup
public GeneratorSetup()Constructor
-
-
Method Details
-
getConfig
public freemarker.template.Configuration getConfig() -
setDefaultFileExtension
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
-
setFileHandler
-
setFreeMarkerTemplateEngine
-
getFreeMarkerTemplateEngine
-
setOutputDirectory
-
getOutputDirectory
-
getClassLoader
-
setGlex
-
getGlex
-
setAdditionalTemplatePaths
-
getAdditionalTemplatePaths
-
getHandcodedPath
- Returns:
- targetPath
-
setHandcodedPath
- 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
- Returns:
- the characters for the start of a comment. Usually same as the target language.
-
setCommentStart
- Parameters:
commentStart- the characters for the start of a comment. Usually same as the target language.
-
getCommentEnd
- Returns:
- the characters for the end of a comment. Usually same as the target language.
-
setCommentEnd
- Parameters:
commentEnd- the characters for the end of a comment. Usually same as the target language.
-
getModelName
- Returns:
- modelName
-
setModelName
- Parameters:
modelName- the modelName to set
-
getAliases
- Returns:
- the aliases
-
setAliases
- Parameters:
aliases- the aliases to set
-
addAlias
-
getNewTemplateController
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
-