Package org.jetbrains.mps.openapi.module
Interface SModule
-
public interface SModuleA module represents a language or a solution.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddModuleListener(SModuleListener listener)Listener can be added only once, the second time it's just not addedIterable<SDependency>getDeclaredDependencies()All dependencies on modules of all kinds.<T extends SModuleFacet>
TgetFacet(Class<T> clazz)Returns facet of the specified class.Iterable<SModuleFacet>getFacets()Retrieves all instantiated facets.SModelgetModel(SModelId id)FIXME document whether this method required model read Retrieves a module's model by idIterable<ModelRoot>getModelRoots()Iterable<SModel>getModels()Retrieves all module's models Contract: if the module was not changed the order of the models which this method returns stays the same.SModuleIdgetModuleId()The repository-wide unique identifierStringgetModuleName()Identical to getModuleReference.getModuleName()SModuleReferencegetModuleReference()A reference to the module, which persists between subsequent read/write actions.SRepositorygetRepository()The repository module has been registered with.Set<SLanguage>getUsedLanguages()Returns all used languages by this moduleintgetUsedLanguageVersion(SLanguage usedLanguage)Returns version of used languagebooleanisPackaged()The module has been imported as a compiled library, not sources.booleanisReadOnly()No updates are permittedvoidremoveModuleListener(SModuleListener listener)
-
-
-
Method Detail
-
getModuleId
SModuleId getModuleId()
The repository-wide unique identifier
-
getModuleName
String getModuleName()
Identical to getModuleReference.getModuleName()
-
getModuleReference
@NotNull SModuleReference getModuleReference()
A reference to the module, which persists between subsequent read/write actions.
-
isReadOnly
boolean isReadOnly()
No updates are permitted
-
isPackaged
boolean isPackaged()
The module has been imported as a compiled library, not sources. Implies read only.
-
getRepository
@Nullable SRepository getRepository()
The repository module has been registered with. Note, you can rely on non-nullvalue to indicate module is still in the repository only if you do so during model read/write. Otherwise, if you ask for module's repository outside of model lock, you may get stale value, e.g. if some other thread detach the module from the repository, so that in your thread:SRepository repo = module.getRepository(); repo.getModelAccess().runReadAction(() -> { SModule actualModule = repo.resolve(module.getModuleReference()); if (actualModule == null) { // legitimate case, module's repo might become stale if obtained outside of model lock } } );
-
getDeclaredDependencies
Iterable<SDependency> getDeclaredDependencies()
All dependencies on modules of all kinds. Includes only dependencies declared in this model. See also GlobalModuleDependenciesManager [not yet in API]
-
getUsedLanguageVersion
int getUsedLanguageVersion(@NotNull SLanguage usedLanguage)
Returns version of used language
-
getModel
@Nullable SModel getModel(SModelId id)
FIXME document whether this method required model read Retrieves a module's model by id
-
getModels
@NotNull Iterable<SModel> getModels()
Retrieves all module's models Contract: if the module was not changed the order of the models which this method returns stays the same.
-
getFacets
@NotNull Iterable<SModuleFacet> getFacets()
Retrieves all instantiated facets. (seeSModuleFacet)
-
getFacet
@Nullable <T extends SModuleFacet> T getFacet(@NotNull Class<T> clazz)
Returns facet of the specified class. If there is more than one facet instance that conforms specified class, it's unspecified which one is returned, usegetFacets()instead and filter as appropriate.
-
addModuleListener
void addModuleListener(SModuleListener listener)
Listener can be added only once, the second time it's just not added
-
removeModuleListener
void removeModuleListener(SModuleListener listener)
-
-