Package jetbrains.mps.persistence
Interface PersistenceVersionAware
- 
- All Superinterfaces:
 SModel
- All Known Implementing Classes:
 DefaultSModelDescriptor
public interface PersistenceVersionAware extends SModel
PROVISIONAL API Indicator for models that track version of model persistence. Version set is specific to particular persistence, i.e. there might be range 1..8 for xml persistence and 1..2 for binary. Model implementing this interface is not necessarily persisted with the version indicated, nor is persisted at all. It's possible to save the same model with different persistence mechanisms, hence this version number is merely a hint and value tracker for persistence implementations that do recognize versions, and is useless for others. Primary purpose of this interface is to break tight coupling of general MPS code with DefaultSModelDescriptor and DefaultSModel which used to keep persistence version, and to get rid ofinstanceof SDefaultModelDescriptor(limits to particular model implementation). Generally, two models implementing this interface not necessarily share same persistence, thusinstanceof PersistenceVersionAwareis not sufficient to tell persistence version values could be directly compared. However, persistence version gets updated the model is read and written, and as such indicates version of the most recent (in case of free-floating models) or default (for regular SModel with associated DataSource) persistence mechanism. 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from interface org.jetbrains.mps.openapi.model.SModel
SModel.Problem 
 - 
 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ModelFactorygetModelFactory()ActualModelFactorywhich is currently responsible for model load/save, ornullif model knowns nothing about persistence at the moment.intgetPersistenceVersion()Version of persistence this model was loaded with, or desired persistence version for model save.voidsetPersistenceVersion(int version)Indicated persistence version for model serialization- 
Methods inherited from interface org.jetbrains.mps.openapi.model.SModel
addAccessListener, addChangeListener, addModelListener, addRootNode, createNode, createNode, getModelId, getModelName, getModelRoot, getModule, getName, getNode, getProblems, getReference, getRepository, getRootNodes, getSource, isLoaded, isReadOnly, load, removeAccessListener, removeChangeListener, removeModelListener, removeRootNode, unload 
 - 
 
 - 
 
- 
- 
Method Detail
- 
setPersistenceVersion
void setPersistenceVersion(int version)
Indicated persistence version for model serialization- Parameters:
 version- persistence version number, or-1for undefined/unknown
 
- 
getPersistenceVersion
int getPersistenceVersion()
Version of persistence this model was loaded with, or desired persistence version for model save.- Returns:
 - persistence version number, or 
-1when undefined 
 
- 
getModelFactory
@Nullable ModelFactory getModelFactory()
ActualModelFactorywhich is currently responsible for model load/save, ornullif model knowns nothing about persistence at the moment.- Returns:
 - model load/save facility or 
nullif undefined 
 
 - 
 
 -