Package jetbrains.mps.generator
Interface GenerationPlanBuilder
- 
- All Known Implementing Classes:
 RegularPlanBuilder,RigidPlanBuilder
public interface GenerationPlanBuilderPROVISIONAL API Capture supported statements of a plan declaration, translate them intoModelGenerationPlaninstance suitable to get toGenerationOptions.OptionsBuilder.customPlan(SModel, ModelGenerationPlan). To use, build a plan with appropriate calls and obtain it with finishingwrapUp(PlanIdentity). Reflects present approach with 'interpreted' GPs. I.e. there's a codeGenPlanExtractorthat 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 afterwrapUp(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 aremodules. There's noSGeneratorcounterpart, 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
 
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classGenerationPlanBuilder.BuilderOption 
- 
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voidapply(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).voidapplyGenerator(SModule... generators)Deprecated.useapplyGenerators(Collection, BuilderOption...)insteadvoidapplyGenerators(Collection<SModuleReference> generators, GenerationPlanBuilder.BuilderOption... options)New approach to plan builder.voidapplyGeneratorWithExtended(SModule... generators)Specified generators and those extending them AND visible from scope applied as a single transformation step.default voiddeclareCheckpoint(CheckpointIdentity cp)Tells generator there's a checkpoint identified certain way.GenerationPlanBuilderfork()Support for parallel branches of transformationsvoidrecordCheckpoint(CheckpointIdentity cp)Tells generator to record state of transformed model at the given moment and keep it with supplied identity.voidsynchronizeWithCheckpoint(CheckpointIdentity cp)Tells generator to synchronize references with a recorded model state, identified by supplied checkpoint.voidtransformLanguage(SLanguage... languages)Apply generators of languages specified to reduce their concepts.ModelGenerationPlanwrapUp(PlanIdentity planIdentity)CompletesModelGenerationPlaninstance with any state information build is aware of (e.g. 
 - 
 
- 
- 
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
 
- 
applyGenerator
@Deprecated void applyGenerator(@NotNull SModule... generators)
Deprecated.useapplyGenerators(Collection, BuilderOption...)insteadSpecified generators (exact set, unlikeapplyGeneratorWithExtended(SModule...)no extended relation between generators is taken into account) applied as a single transformation step. FIXME shall decide what happens if a generator references/extends another one, not mentioned.- Parameters:
 generators- generator modules
 
- 
applyGeneratorWithExtended
void applyGeneratorWithExtended(@NotNull SModule... generators)
Specified generators and those extending them AND visible from scope applied as a single transformation step. What constitutes this 'scope' is up to plan builder implementation. To respect generator priority rules of involved generators to address extensibility scenarios like that of lang.editor, considerapplyGenerators(Collection, BuilderOption...)withGenerationPlanBuilder.BuilderOption.WithPriorityRulesandGenerationPlanBuilder.BuilderOption.WithExtendedGenerators.- Parameters:
 generators- generator modules
 
- 
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 stepoptions- optional set of options to further specify processing ofgeneratorsset- 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
 
 
- 
wrapUp
@NotNull ModelGenerationPlan wrapUp(@NotNull PlanIdentity planIdentity)
CompletesModelGenerationPlaninstance with any state information build is aware of (e.g. build extends relation between generators foror respect priority rules of generators involved- Parameters:
 planIdentity- identity of the plan to build- Returns:
 - plan instance ready to use
 
 
 - 
 
 -