Class TemplateLangModelUtility
- java.lang.Object
-
- net.ssehub.easy.dslCore.ModelUtility<de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit,Template>
-
- de.uni_hildesheim.sse.vil.templatelang.TemplateLangModelUtility
-
- All Implemented Interfaces:
IModelLoader<Template>
public class TemplateLangModelUtility extends ModelUtility<de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit,Template> implements IModelLoader<Template>
Provides language-wide functionality.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.ssehub.easy.basics.modelManagement.IModelLoader
IModelLoader.IModelInfoHolder<M extends IModel>, IModelLoader.LoadResult<M extends IModel>
-
-
Field Summary
Fields Modifier and Type Field Description static TemplateLangModelUtilityINSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description privateTemplateLangModelUtility()Prevents external creation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExpressioncreateExpression(java.lang.String text, IRuntimeEnvironment environment)ExpressioncreateExpression(java.lang.String text, Resolver resolver, java.lang.StringBuilder warnings)Parsestextinto an expression.ExpressioncreateExpression(java.lang.String text, Resolver resolver, java.lang.StringBuilder warnings, IvmlMessageAdapter adapter)Parsestextinto an expression.TranslationResult<Template>createModel(de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit root, java.net.URI uri, boolean registerSuccessful)Create the build language model from an EMF implementation unit.java.lang.StringgetExtension()Returns the file extension / identifier to react on.protected java.lang.ClassLoadergetLanguageClassLoader()Returns the actual class loader of the language.protected java.lang.StringgetLanguageName()Returns the language name as specified in the xText configuration.protected voidinitializeAfterResourceInitializer()Initializes instances which depend onModelUtility.resourceInitializer.java.util.List<ModelInfo<Template>>obtainInfo(org.eclipse.emf.common.util.URI uri)Obtains model information.TranslationResult<Template>parse(org.eclipse.emf.common.util.URI uri, ImportResolver<Template> resolver)Parse an IVML model file for standalone application (without editor) with a given import resolver.
Note: This method is called byde.uni_hildesheim.sse.model.management.VarModelso if you intend to use the management facilities inde.uni_hildesheim.sse.model.management.VarModellet thede.uni_hildesheim.sse.model.management.VarModeldo this job for you and do not call this method directly!voidprint(TranslationResult<Template> result, java.io.Writer out, boolean emitComments, boolean emitImports)Prints the model stored in the result to the console output stream (for debugging / testing).-
Methods inherited from class net.ssehub.easy.dslCore.ModelUtility
append, appendWithNewLine, getGrammar, getInjector, getResourceInitializer, getResourceSet, handles, load, obtainInfo, parse, parse, parse, parseFragment, scan, setInjector, setResourceInitializer, toNetUri
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.ssehub.easy.basics.modelManagement.IModelLoader
load, scan
-
-
-
-
Field Detail
-
INSTANCE
public static final TemplateLangModelUtility INSTANCE
-
-
Method Detail
-
initializeAfterResourceInitializer
protected void initializeAfterResourceInitializer()
Initializes instances which depend onModelUtility.resourceInitializer.- Specified by:
initializeAfterResourceInitializerin classModelUtility<de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit,Template>
-
createModel
public TranslationResult<Template> createModel(de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit root, java.net.URI uri, boolean registerSuccessful)
Create the build language model from an EMF implementation unit.- Parameters:
root- the root-level build unituri- the URI of the project to resolve (in order to find the closest project, may be null)registerSuccessful- successfully created models shall be registered- Returns:
- the created variability model including messages
-
parse
public TranslationResult<Template> parse(org.eclipse.emf.common.util.URI uri, ImportResolver<Template> resolver) throws java.io.IOException
Description copied from class:ModelUtilityParse an IVML model file for standalone application (without editor) with a given import resolver.
Note: This method is called byde.uni_hildesheim.sse.model.management.VarModelso if you intend to use the management facilities inde.uni_hildesheim.sse.model.management.VarModellet thede.uni_hildesheim.sse.model.management.VarModeldo this job for you and do not call this method directly!- Specified by:
parsein classModelUtility<de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit,Template>- Parameters:
uri- the location of the model, e.g. via URI.createURI("dummy:/example.ex1")resolver- the import resolver (may be null for a new default import resolver)- Returns:
- the created variability model including messages
- Throws:
java.io.IOException- in case of any I/O or URI problem
-
print
public void print(TranslationResult<Template> result, java.io.Writer out, boolean emitComments, boolean emitImports)
Prints the model stored in the result to the console output stream (for debugging / testing).- Parameters:
result- the result instanceout- the output writeremitComments- whether comments shall be emittedemitImports- whether imports shall be emitted
-
getLanguageName
protected java.lang.String getLanguageName()
Description copied from class:ModelUtilityReturns the language name as specified in the xText configuration. This name can be found as URL in the grammar file or corresponds to the Java path of the grammar-XMI file in src-gen.- Specified by:
getLanguageNamein classModelUtility<de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit,Template>- Returns:
- the language name in Java package notation
-
getLanguageClassLoader
protected java.lang.ClassLoader getLanguageClassLoader()
Description copied from class:ModelUtilityReturns the actual class loader of the language. This loader may be different due to different bundles.- Specified by:
getLanguageClassLoaderin classModelUtility<de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit,Template>- Returns:
- the class loader
-
createExpression
public Expression createExpression(java.lang.String text, Resolver resolver, java.lang.StringBuilder warnings) throws VilException
Parsestextinto an expression.- Parameters:
text- the text to be parsedenvironment- the runtime environment for resolving variablesan- optional buffer to collect warnings- Returns:
- the resulting expression
- Throws:
VilException- in case that parsing fails
-
createExpression
public Expression createExpression(java.lang.String text, Resolver resolver, java.lang.StringBuilder warnings, IvmlMessageAdapter adapter) throws VilException
Parsestextinto an expression.- Parameters:
text- the text to be parsedenvironment- the runtime environment for resolving variablesan- optional buffer to collect warningsadapter- optional message adapter (may be null for default)- Returns:
- the resulting expression
- Throws:
VilException- in case that parsing fails
-
createExpression
public Expression createExpression(java.lang.String text, IRuntimeEnvironment environment) throws VilException
- Throws:
VilException
-
getExtension
public java.lang.String getExtension()
Description copied from class:ModelUtilityReturns the file extension / identifier to react on.- Specified by:
getExtensionin classModelUtility<de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit,Template>- Returns:
- the extension
-
obtainInfo
public java.util.List<ModelInfo<Template>> obtainInfo(org.eclipse.emf.common.util.URI uri) throws java.io.IOException
Obtains model information.- Specified by:
obtainInfoin classModelUtility<de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit,Template>- Parameters:
uri- the URI to read the info from- Returns:
- the project info instances related to
uri - Throws:
java.io.IOException- in case that an I/O error happens during parsing
-
-