Interface MetaModelInfoProvider

  • All Known Implementing Classes:
    MetaModelInfoProvider.BaseMetaModelInfo, MetaModelInfoProvider.RegularMetaModelInfo, MetaModelInfoProvider.StuffedMetaModelInfo

    public interface MetaModelInfoProvider
    PROVISIONAL API, DO NOT USE

    This class hides mechanism to access aspects of meta-model we need for persistence purposes. Generally, this information could be retrieved from SConcept/ConceptDescriptor and friends, however, there are two use-cases when we can't rely on general MPS mechanism: 1) Model merge, primarily (or only) merge driver (git-invoked conflict resolution tool). 2) Convert models to binary during build.

    In either case, we read model first, and then save, and need save to know (and keep) information we've read.

    The reasons not to use general MPS mechanism are: (a) We don't want to pay MPS start-up costs (b) Languages used in the models might not be available in classpath (Doesn't apply to (2) - we do know them during build)

    The idea is to fill this provider with information read, and use it from model write. This provider shall not survive single read/write pair for a given model. Although perhaps in the future we might utilize it to keep model-specific DebugRegistry, which is global at the moment.

    To certain extent, this class serves to overcome limitations of SConcept API, as it doesn't expose e.g. scope or kind. Once (and if) we decide to expose these from SConcept, there would be no need in this mediator. Perhaps, it's the right way to go? XXX revisit

    Note, this class replaces jetbrains.mps.persistence.ModelEnvironmentInfo which was likely intended for the similar purpose, but is ugly and doesn't suite modern (v9-bis) persistence well.

    There's implementation for most use-cases, MetaModelInfoProvider.RegularMetaModelInfo, which merely delegates to appropriate general MPS facilities, and doesn't support change (attempt to change is no-op).

    IMPLEMENTATION NOTE: use MetaModelInfoProvider.BaseMetaModelInfo as base class, do not implement this interface directly.

    Instances are not thread-safe unless noted otherwise.

    All methods are allowed to return null to indicate provider knows nothing about attribute questioned. Setters arguments, except for id (i.e. name, concept kind, etc), may be null as well.

    See Also:
    MetaModelInfoProvider.BaseMetaModelInfo, DebugRegistry, jetbrains.mps.persistence.ModelEnvironmentInfo