Search in sources :

Example 1 with ModelBuilderImpl

use of com.devonfw.cobigen.impl.model.ModelBuilderImpl in project cobigen by devonfw.

the class CobiGenImpl method getModelBuilder.

@Override
public ModelBuilder getModelBuilder(Object input) {
    List<String> matchingTriggerIds = getMatchingTriggerIds(input);
    // Just take the first trigger as all trigger should have the same input reader. See javadoc.
    Trigger trigger = this.configurationHolder.readContextConfiguration().getTrigger(matchingTriggerIds.get(0));
    return new ModelBuilderImpl(input, trigger);
}
Also used : ModelBuilderImpl(com.devonfw.cobigen.impl.model.ModelBuilderImpl) Trigger(com.devonfw.cobigen.impl.config.entity.Trigger)

Example 2 with ModelBuilderImpl

use of com.devonfw.cobigen.impl.model.ModelBuilderImpl in project cobigen by devonfw.

the class GenerationProcessorImpl method buildModel.

/**
 * Builds the model for he given input.
 *
 * @param triggerInterpreter {@link TriggerInterpreter} to be used
 * @param trigger activated {@link Trigger}
 * @param generatorInput input for generation to retrieve information from.
 * @param template the internal {@link Template} representation
 * @return the object model for generation.
 */
private Map<String, Object> buildModel(TriggerInterpreter triggerInterpreter, Trigger trigger, Object generatorInput, Template template) {
    ModelBuilderImpl modelBuilderImpl = new ModelBuilderImpl(generatorInput, trigger);
    Map<String, Object> model;
    if (this.rawModel != null) {
        model = this.rawModel;
    } else {
        model = modelBuilderImpl.createModel(triggerInterpreter);
    }
    modelBuilderImpl.enrichByContextVariables(model, triggerInterpreter, template, this.targetRootPath, this.generationReport);
    if (this.logicClassesModel != null) {
        model.putAll(this.logicClassesModel);
    }
    return model;
}
Also used : ModelBuilderImpl(com.devonfw.cobigen.impl.model.ModelBuilderImpl)

Aggregations

ModelBuilderImpl (com.devonfw.cobigen.impl.model.ModelBuilderImpl)2 Trigger (com.devonfw.cobigen.impl.config.entity.Trigger)1