Interface SModule


  • public interface SModule
    A module represents a language or a solution.
    • 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

        SRepository getRepository()
        The owning repository
      • 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]
      • getUsedLanguages

        Set<SLanguage> getUsedLanguages()
        Returns all used languages by this module
      • getUsedLanguageVersion

        int getUsedLanguageVersion​(@NotNull
                                   SLanguage usedLanguage)
        Returns version of used language
      • resolveInDependencies

        @Nullable
        @Deprecated
        SModel resolveInDependencies​(SModelId ref)
        Deprecated.
        This method has been deprecated since it doesn't help to resolve SModelId that are not unique I.e. if few modules from dependencies provide model with the same id (happens for java package models), then the model returned would depend from iteration order. Instead, use SModelReference.resolve(SRepository) meanwhile. NOTE: returns getModel(SModelId) now, pending method removal. The method will be removed after MPS 3.4 release FIXME decide whether we need resolveInDependencies(SModelReference), which might be handy to give module control over dependency resolution, or do the scope control (whether module of model requested belongs to imports of this module) externally. Perhaps, there's a case when one knows only SModelId (i.e. looks up smth like "java.io", and we'd need a method to return a collection of models with this id visible from dependencies then). Another approach is to expose smth like getScope() (which is already in AbstractModule), to encapsulate scope control. It would be both separate and controlled by module (consider TransientModelsModule which needs to resolve references between transient models that are not published in a repository) Find the specified model among the dependencies. Models of this module (getModel(SModelId)) are considered and take precedence over models from dependency modules
        FIXME document whether this method required model read
        Returns:
        The desired model or null, if not found.
      • 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.
      • 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, use getFacets() 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)