Interface ModelRoot
-
public interface ModelRootRepresents a logically connected group of models that come from a related physical origin, such as a file or a directory. For implementation consider extendingjetbrains.mps.extapi.persistence.ModelRootBase,jetbrains.mps.extapi.persistence.FolderModelRootBaseorjetbrains.mps.extapi.persistence.FileBasedModelRoot. The model root MPS workflow is as follows: 1. ModelRoot is constructed; 2. The methodload(Memento)is called to fill theModelRootwith data. Note that any model root must be attached to a module during construction- See Also:
getModule()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description booleancanCreateModel(String modelName)Deprecated.use the one with SModelName as parameterdefault booleancanCreateModel(SModelName modelName)booleancanCreateModels()Deprecated.use specific #canCreateModel(SModelName)SModelcreateModel(String modelName)Creates a new model with the given name.SModelgetModel(SModelId id)Iterable<SModel>getModels()SModulegetModule()The owning module which must be present as well.StringgetPresentation()A textual representation of the model rootStringgetType()A customizable categorization identifier, such as JavaStubsvoidload(Memento memento)Allows the model root to read its previously saved configuration informationvoidsave(Memento memento)Gives the model root the opportunity to persist into the supplied memento whatever configuration information may be needed to restore the models in the future.
-
-
-
Method Detail
-
getType
String getType()
A customizable categorization identifier, such as JavaStubs
-
getPresentation
String getPresentation()
A textual representation of the model root
-
getModule
SModule getModule()
The owning module which must be present as well. The module must be fixed for a model root and passed via constructor (TODO) obviously the returned module is the one which has this model root among itsSModule.getModelRoots()
-
getModel
@Nullable SModel getModel(@NotNull SModelId id)
- Returns:
- the model with a given id one-to-one relation is assumed
-
getModels
@NotNull Iterable<SModel> getModels()
- Returns:
- a sequence of the models under this model root.
Implementors must impose some order on the returned result, such that
two consequent invocations of this method return equal results.
Note that owning module also returns all the models (module is believed to be a model container)
SModule.getModels(), however it might contain the models which are not attached to the model roots as well (!)
-
canCreateModels
@Deprecated boolean canCreateModels()
Deprecated.use specific #canCreateModel(SModelName)There are model roots which are read-only and fix the result ofgetModels()right away from the construction FIXME it is strange to have two similar methods: we are better to merge this method into the methodcanCreateModel(java.lang.String).- Returns:
- whether this model root is read-only in the way described above
-
canCreateModel
@Deprecated boolean canCreateModel(@NotNull String modelName)
Deprecated.use the one with SModelName as parameter- Parameters:
modelName- -- the same as in thecreateModel(String)- Returns:
- whether a model with a name
modelNamecan be created under this model root.
-
canCreateModel
default boolean canCreateModel(@NotNull SModelName modelName)
-
createModel
@Nullable SModel createModel(@NotNull String modelName)
Creates a new model with the given name. The new model will be contained in this model root (methods #getModel, #getModels).- Parameters:
modelName- -- might fq name or just simple short model name. Up to implementor- See Also:
// * @deprecated // * @return null if failed, for instance returned false.
-
save
void save(@NotNull Memento memento)
Gives the model root the opportunity to persist into the supplied memento whatever configuration information may be needed to restore the models in the future.
-
-