Interface GenerationPlanBuilder

  • All Known Implementing Classes:
    RegularPlanBuilder, RigidPlanBuilder

    public interface GenerationPlanBuilder
    PROVISIONAL API Capture supported statements of a plan declaration, translate them into ModelGenerationPlan instance suitable to get to GenerationOptions.OptionsBuilder.customPlan(SModel, ModelGenerationPlan).

    To use, build a plan with appropriate calls and obtain it with finishing wrapUp(PlanIdentity).

    Reflects present approach with 'interpreted' GPs. I.e. there's a code GenPlanExtractor that reads model with a plan and uses this builder to create a plan instance. However, might not be handy once we switch to generated plan representation. We'll need some persisted presentation of a plan (although could generate a plain Java code that invokes methods of this builder?)

    It's up to implementation to decide about builder instance re-use (i.e. what happens if new statements are added after wrapUp(PlanIdentity)) XXX it's not quite convenient to use varargs from smodel code (more suited for generated). Either introduce alternatives with collections or consider intermediate step builder to fill one by one. FIXME API is inconsistent as we reference languages using deployment identity (SLanguage), while for generators there are modules. There's no SGenerator counterpart, and use of GeneratorRuntime would imply use of LanguageRuntime instead of SLanguage, so I don't see any better alternative at the moment.

    Since:
    2017.1
    • Method Detail

      • transformLanguage

        void transformLanguage​(@NotNull
                               SLanguage... languages)
        Apply generators of languages specified to reduce their concepts. FIXME It's unspecified at the moment what happens with generators that are extended or referenced from those involved (i.e. if they are part of the step).
        Parameters:
        languages - languages to reduce
      • applyGenerators

        void applyGenerators​(@NotNull
                             Collection<SModuleReference> generators,
                             @NotNull
                             GenerationPlanBuilder.BuilderOption... options)
        New approach to plan builder. As there's SLanguage for deployed language, there's SModuleReference to identify deployed generator, why would I need to get a module then?
        Parameters:
        generators - deployed generator identities for the step
        options - optional set of options to further specify processing of generators set
        Since:
        2017.2
      • apply

        void apply​(@NotNull
                   Collection<TemplateMappingConfiguration> tmc)
        IMPORTANT: USE OF THIS METHOD IS DISCOURAGED AS IT AFFECTS CONSISTENCY OF PLAN SPECIFICATION (namely, if applyGeneratorWithExtended() shall consider generators of explicit MCs for extensions). IT'S INTENDED FOR PROTOTYPE AND MIGHT CEASE ONCE PROVISION PHASE IS OVER. USE AT YOUR OWN RISK. Specific MCs for a transformation step, applied together.
        Parameters:
        tmc - MCs that constitute transformation step
      • declareCheckpoint

        default void declareCheckpoint​(@NotNull
                                       CheckpointIdentity cp)
        Tells generator there's a checkpoint identified certain way. Generally, we don't need to do anything about this when building a plan, as declaration of a CP doesn't affect anything and is merely an anchor record/persist and synchronize actions could reference. Nevertheless, builder has a chance to react to CP declaration if deemed necessary.
        Parameters:
        cp - checkpoint identity
      • recordCheckpoint

        void recordCheckpoint​(@NotNull
                              CheckpointIdentity cp)
        Tells generator to record state of transformed model at the given moment and keep it with supplied identity. Besides, also tells generator to synchronize external references with models of the specified checkpoint.
        Parameters:
        cp - checkpoint identity
      • synchronizeWithCheckpoint

        void synchronizeWithCheckpoint​(@NotNull
                                       CheckpointIdentity cp)
        Tells generator to synchronize references with a recorded model state, identified by supplied checkpoint. State of the actual model being transformed is not recorded.
        Parameters:
        cp - checkpoint identity
      • fork

        GenerationPlanBuilder fork()
        Support for parallel branches of transformations
        Returns:
        builder instance to handle separate branch of transformations