Package jetbrains.mps.generator.runtime
Class TemplateModuleBase
- java.lang.Object
 - 
- jetbrains.mps.generator.runtime.TemplateModuleBase
 
 
- 
- All Implemented Interfaces:
 TemplateModule,GeneratorRuntime
- Direct Known Subclasses:
 TemplateModuleInterpreted2
public abstract class TemplateModuleBase extends Object implements TemplateModule
Descriptors for generated generators shall extends this class to facilitate future TemplateModule API changes 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTemplateModuleBase.ReferencedGenerators 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedTemplateModuleBase()protectedTemplateModuleBase(LanguageRegistry languageRegistry, LanguageRuntime sourceLanguage) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidfillReferencedGenerators(TemplateModuleBase.ReferencedGenerators referencedGenerators)Code that relies on default implementation of getEmployedGenerators()/getExtendedGenerators() shall override this method and supply relevant dependencies intoTemplateModuleBase.ReferencedGenerators.Collection<TemplateModule>getEmployedGenerators()Generators that are utilized by this one, e.g.Collection<TemplateModule>getExtendedGenerators()Generators this generator explicitly extends.Collection<TemplateModel>getModels()Collection<TemplateMappingPriorityRule>getPriorities()Set<SLanguage>getQueryLanguages()Languages we wrote queries in XXX is there need for these in generator runtime? or just in Generator SModule?LanguageRuntimegetSourceLanguage()IMPLEMENTATION NOTE: Now GeneratorRuntime is instantiated with appropriate runtime instance of its language, which is natural given the way generators are declared.StringtoString()- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 
- 
Methods inherited from interface jetbrains.mps.smodel.language.GeneratorRuntime
getModuleReference 
- 
Methods inherited from interface jetbrains.mps.generator.runtime.TemplateModule
getAlias, getTargetLanguages 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
TemplateModuleBase
protected TemplateModuleBase()
 
- 
TemplateModuleBase
protected TemplateModuleBase(LanguageRegistry languageRegistry, LanguageRuntime sourceLanguage)
- Parameters:
 languageRegistry- notnull(unless your subclass overrides all the methods of this base class that need that registry).sourceLanguage- notnull.
 
 - 
 
- 
Method Detail
- 
getSourceLanguage
@NotNull public LanguageRuntime getSourceLanguage()
Description copied from interface:GeneratorRuntimeIMPLEMENTATION NOTE: Now GeneratorRuntime is instantiated with appropriate runtime instance of its language, which is natural given the way generators are declared. However, another approach seems more general and is worth considering: (a) GeneratorRuntime could answer SLanguage/set{SLanguage} itself (GR instantiated using no-arg default constructor) (b) GR doesn't tell its source language, instead, this information is recorded externally e.g. in module descriptor/manifest Though (b) is most flexible, (a) seems to be aligned with the rest of MPS and more convenient provided we need to go from GR to LR and back. (c) LanguageRuntime of source language is kept internally by GeneratorRuntime, and it registers/unregisters itself with API of attach/detach (to hide implementation details, although LR is hardly an implementation detail to hide)- Specified by:
 getSourceLanguagein interfaceGeneratorRuntime- Returns:
 - language this generator is associated with
 
 
- 
getModels
public Collection<TemplateModel> getModels()
- Specified by:
 getModelsin interfaceTemplateModule- Returns:
 - set of models in the generator module, generally not empty, never 
null. 
 
- 
getPriorities
public Collection<TemplateMappingPriorityRule> getPriorities()
- Specified by:
 getPrioritiesin interfaceTemplateModule- Returns:
 - collection (possibly empty) of priority rules defined in this generator module, never 
null. 
 
- 
getExtendedGenerators
public Collection<TemplateModule> getExtendedGenerators()
Description copied from interface:TemplateModuleGenerators this generator explicitly extends. This effectively means rules and switches from all extended generators are considered.- Specified by:
 getExtendedGeneratorsin interfaceTemplateModule
 
- 
fillReferencedGenerators
protected void fillReferencedGenerators(TemplateModuleBase.ReferencedGenerators referencedGenerators)
Code that relies on default implementation of getEmployedGenerators()/getExtendedGenerators() shall override this method and supply relevant dependencies intoTemplateModuleBase.ReferencedGenerators. This method is no-op by default. 
- 
getEmployedGenerators
public Collection<TemplateModule> getEmployedGenerators()
Description copied from interface:TemplateModuleGenerators that are utilized by this one, e.g. by invoking their templates, excluding extended generators. Employed generators do not contribute their reduction rules (other than those involved through $SWITCH$ call of invoked template)- Specified by:
 getEmployedGeneratorsin interfaceTemplateModule
 
- 
getQueryLanguages
public Set<SLanguage> getQueryLanguages()
Description copied from interface:TemplateModuleLanguages we wrote queries in XXX is there need for these in generator runtime? or just in Generator SModule?- Specified by:
 getQueryLanguagesin interfaceTemplateModule
 
 - 
 
 -