Package org.eclipse.epsilon.egl
Class EglPersistentTemplate
- java.lang.Object
-
- org.eclipse.epsilon.egl.EglTemplate
-
- org.eclipse.epsilon.egl.EglPersistentTemplate
-
- Direct Known Subclasses:
CountingTemplate
,EglFileGeneratingTemplate
,VirtualTemplate
public abstract class EglPersistentTemplate extends EglTemplate
-
-
Field Summary
Fields Modifier and Type Field Description protected URI
outputRoot
protected String
outputRootPath
-
Fields inherited from class org.eclipse.epsilon.egl.EglTemplate
listeners, module, name, template
-
-
Constructor Summary
Constructors Constructor Description EglPersistentTemplate(EglTemplateSpecification spec, IEglContext context, URI outputRoot)
EglPersistentTemplate(EglTemplateSpecification spec, IEglContext context, URI outputRoot, String outputRootPath)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addMessage(String message)
protected abstract void
doGenerate(File file, String targetName, boolean overwrite, boolean merge)
Store result of processing template in the given file.void
generate(String path)
The preferred way of generating code from a persistent template, this stores the generation result in the given file, maintaining any protected regions.File
generate(String path, boolean overwrite, boolean merge)
Fully parameterised version of generate, usually only used internally.protected String
name(String path)
protected File
resolveFile(String path)
void
store(String path)
Deprecated.Use generate(path) instead, or generate(path, false, false), if you really know what you are doing :-)void
store(String path, boolean overwrite)
Deprecated.Use generate(path) instead, or generate(path, overwrite, false), if you really know what you are doing :-)-
Methods inherited from class org.eclipse.epsilon.egl.EglTemplate
addProtectedRegionWarning, getContents, getDeclaredModelDefinitions, getDeclaredOperations, getFormatter, getImports, getIncrementalitySettings, getModelDefinitions, getModule, getName, getOperations, getParseProblems, getTemplate, isProcessed, merge, populate, printWarning, process, reset, setFormatter, setFormatters, setFormatters, setIncrementalitySettings
-
-
-
-
Constructor Detail
-
EglPersistentTemplate
public EglPersistentTemplate(EglTemplateSpecification spec, IEglContext context, URI outputRoot) throws Exception
- Parameters:
spec
-context
-outputRoot
-- Throws:
Exception
- Since:
- 1.6
-
EglPersistentTemplate
public EglPersistentTemplate(EglTemplateSpecification spec, IEglContext context, URI outputRoot, String outputRootPath) throws Exception
- Throws:
Exception
-
-
Method Detail
-
resolveFile
protected File resolveFile(String path) throws EglRuntimeException
- Throws:
EglRuntimeException
-
store
public void store(String path) throws EglRuntimeException
Deprecated.Use generate(path) instead, or generate(path, false, false), if you really know what you are doing :-)This processes the template and stores the result in the given file, provided that this file does not exist yet. This method is here for backward compatibility only.- Parameters:
path
-- Throws:
EglRuntimeException
-
store
public void store(String path, boolean overwrite) throws EglRuntimeException
Deprecated.Use generate(path) instead, or generate(path, overwrite, false), if you really know what you are doing :-)This processes the template and stores the result in the given file. If overwrite is false, an existing file will prevent the result from being written. If overwrite is true, any existing file will be overwritten, not respecting protected regions. This method is here for backward compatibility only.- Parameters:
path
-overwrite
-- Throws:
EglRuntimeException
-
generate
public final void generate(String path) throws EglRuntimeException
The preferred way of generating code from a persistent template, this stores the generation result in the given file, maintaining any protected regions.- Parameters:
path
-- Throws:
EglRuntimeException
-
generate
public File generate(String path, boolean overwrite, boolean merge) throws EglRuntimeException
Fully parameterised version of generate, usually only used internally. Setting overwrite to false implies merge is ignored.- Parameters:
path
-overwrite
-merge
-- Returns:
- The output file.
- Throws:
EglRuntimeException
-
doGenerate
protected abstract void doGenerate(File file, String targetName, boolean overwrite, boolean merge) throws EglRuntimeException
Store result of processing template in the given file. Subclasses should override to implement the specific semantics of 'storing' to a file. The result of processing the template will be available fromEglTemplate.contents
.- Parameters:
path
-targetName
-overwrite
-merge
-- Throws:
EglRuntimeException
-
addMessage
protected void addMessage(String message)
-
-