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

        @Nullable
        SRepository getRepository()
        The repository module has been registered with. Note, you can rely on non-null value 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]
      • getUsedLanguages

        Set<SLanguage> getUsedLanguages()
        Returns all used languages by this module
      • 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.
      • 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)