Class SModelHeader


  • public class SModelHeader
    extends Object
    Essential meta information about persisted model (id, persistence version, associated properties, etc). Its intention is to keep data that might be helpful/essential prior to model loading. Generally, use of header for a model persistence is optional, it comes handy for partial model loading and is in use by most persistence implementations supplied by MPS.
    • Constructor Detail

      • SModelHeader

        public SModelHeader()
    • Method Detail

      • getPersistenceVersion

        public int getPersistenceVersion()
      • setPersistenceVersion

        public void setPersistenceVersion​(int persistenceVersion)
      • isDoNotGenerate

        public boolean isDoNotGenerate()
      • setDoNotGenerate

        public void setDoNotGenerate​(boolean doNotGenerate)
      • getModelReference

        @Nullable
        public SModelReference getModelReference()
        DESIGN NOTE: SModelReference is not a persisted attribute of a model. Conceptually, reference emerges once we have an object to point to. The moment we got SModelHeader there's nothing to point to yet, although one could construct SModelReference with
        Returns:
        null if model header is not initialized with a model reference
      • getOptionalProperties

        public Map<String,​String> getOptionalProperties()
      • getOptionalProperty

        public String getOptionalProperty​(String key)
      • setOptionalProperty

        public void setOptionalProperty​(String key,
                                        String value)
      • removeOptionalProperty

        public void removeOptionalProperty​(String key)
      • setMetaInfoProvider

        public void setMetaInfoProvider​(@Nullable
                                        MetaModelInfoProvider mmiProvider)
        PROVISIONAL, DO NOT USE (unless your name starts with 'A' and you know what you're doing) This is per-model mechanism to alter meta-model (aka structure model) information used in persistence. Generally, this mechanism shall not be in use, and null value is legitimate default, which means native MPS mechanism of SConcept (and ConceptDescriptors) would be in use. However, certain scenarios (command-line merge and ant task to convert models to binary) can't yet afford starting whole MPS and thus shall rely on meta-information read from model files (which is generally sufficient to write the files back). For these scenarios, we used to have global jetbrains.mps.persistence.ModelEnvironmentInfo, which is global and a bit outdated for modern persistence, hence it has been replaced with MetaModelInfoProvider, although this solution is provisional and likely to get changed in future (perhaps, class known now as IdInfoCollector would replace it).
      • create

        public static SModelHeader create​(int persistenceVersion)