Package jetbrains.mps.module
Interface ReloadableModule
- 
- All Superinterfaces:
 SModule
- All Known Implementing Classes:
 Generator,Language,ReloadableModuleBase,Solution,StubSolution,TempModule,TestLanguage
public interface ReloadableModule extends SModule
Represents a module which can be associated with some class loader, it is a unit in the MPS class loading subsystem. The naming is poor: the better choice would be "DeployedModule". Only some of ReloadableModule can be really reloaded at runtime. (to be precise the modules which have CustomClassLoadingFacet could not be reloaded) For example suppose there is a language module L in MPS. Also let there be a solution S which uses the language L. Imagine that at some point you decide to change the language L, e.g. change the editor representation for some concept C in the language L. Obviously you expect MPS to change the UI appearance for the instances of the concept C in the solution S. Moreover you want MPS to change the UI representation right after the used language L is generated and compiled. To enable such workflow MPS introduces its own class loading subsystem. Also it brings in a notion of reloadable modules such modules which can be redeployed during design-time in MPS (the idea plugin modules are the exception) So the language L in the given example is clearly a reloadable module. As for 191 the common workflow must look like this:default void invokeMethodFoo(@NotNull ReloadableModule module) { DeploymentStatus status = module.getStatus(); if (!status.canBeDeployed()) {return; } try { Class> main = module.getClass("Main"); Object instance = main.newInstance(); } catch (ClassNotFoundException e) { } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } }  
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceReloadableModule.DeploymentStatus 
- 
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default booleancanLoadClasses()For some subclasses it is possible to disable class loading forReloadableModule.Class<?>getClass(String classFqName)default ClassLoadergetClassLoader()Deprecated.MPSModuleClassLoadergetClassLoader0()Class<?>getOwnClass(String classFqName)ReloadableModule.DeploymentStatusgetStatus()voidreload()Call it to replace the old class loader of this module with a new one.default booleanwillLoad()Deprecated.bad naming, use #canLoadClasses or sometimes it is more convenient to use getStatus#isDeployed- 
Methods inherited from interface org.jetbrains.mps.openapi.module.SModule
addModuleListener, getDeclaredDependencies, getFacet, getFacets, getModel, getModelRoots, getModels, getModels, getModuleId, getModuleName, getModuleReference, getRepository, getUsedLanguages, getUsedLanguageVersion, isPackaged, isReadOnly, removeModuleListener 
 - 
 
 - 
 
- 
- 
Method Detail
- 
getClass
@NotNull Class<?> getClass(@NotNull String classFqName) throws ClassNotFoundException
- Returns:
 - a class which can be obtained by calling #getclass from
 
getClassLoader()method. a ModuleClassLoader. ModuleClassLoader's #loadClass method yields some additional information about the reasons of class which could not be found. Clients of this API are supposed to process it on their own behalf. * @see jetbrains.mps.classloading.ModuleClassNotFoundException * @see jetbrains.mps.classloading.ModuleIsNotLoadableException warning: this method is lazy implemented! - Throws:
 ClassNotFoundException
 
- 
getOwnClass
@NotNull Class<?> getOwnClass(@NotNull String classFqName) throws ClassNotFoundException
- Returns:
 - a class which can be obtained by calling #getClass from
 
getClassLoader()method in the case when the defining class loader is a ModuleClassLoader. - Throws:
 ClassNotFoundException- See Also:
 ModuleClassNotFoundException,ModuleIsNotLoadableException,ModuleClassLoader,warning: this method is lazy implemented!
 
- 
getClassLoader
@Nullable @Deprecated default ClassLoader getClassLoader()
Deprecated.- Returns:
 - the class loader associated with the module. Currently it can be either MPS ModuleClassLoader or IdeaPlugin PluginClassLoader. The latter is returned in the case when IDEA plugin manages the module's classes. Use it if you want to get a class from the module with IdeaPluginFacet. warning: this method is lazy implemented! if getStatus().isDeployed() || getStatus().canBeDeployed() is true then the return value is guaranteed to be not null
 
 
- 
getClassLoader0
@NotNull MPSModuleClassLoader getClassLoader0()
- Returns:
 - not null classloader, if a specific module-related class loader is not found than the system classloader is returned
 
 
- 
reload
void reload()
Call it to replace the old class loader of this module with a new one. To reload more than one module all together check outClassLoaderManager.reloadModules(Iterable, org.jetbrains.mps.openapi.util.ProgressMonitor)method. 
- 
willLoad
@Deprecated default boolean willLoad()
Deprecated.bad naming, use #canLoadClasses or sometimes it is more convenient to use getStatus#isDeployed- Returns:
 - true if it will load classes.
 For some subclasses it is possible to disable class loading for 
ReloadableModule. E.g. solution without idea/mps facet cannot load classes - See Also:
 Solution
 
- 
canLoadClasses
default boolean canLoadClasses()
For some subclasses it is possible to disable class loading forReloadableModule. E.g. solution without idea/mps facet cannot load classes- See Also:
 Solution
 
- 
getStatus
@NotNull ReloadableModule.DeploymentStatus getStatus()
 
 - 
 
 -