All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.nemerosa.ontrack.model.structure.TemplateInstanceExecution Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
package net.nemerosa.ontrack.model.structure;

import lombok.Data;

import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * Execution context for the creation of a template instance.
 */
@Data
public class TemplateInstanceExecution {

    /**
     * Replacement function to use
     */
    private final Function replacementFn;

    /**
     * List of resolved template definition parameters
     */
    private final Map parameterValues;

    /**
     * Performs a replacement
     */
    public String replace(String value) {
        return replacementFn.apply(value);
    }

    public List asTemplateParameterValues() {
        return parameterValues.entrySet().stream()
                .map(entry -> new TemplateParameterValue(entry.getKey(), entry.getValue()))
                .collect(Collectors.toList());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy