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

org.yamcs.templating.Template Maven / Gradle / Ivy

There is a newer version: 5.10.9
Show newest version
package org.yamcs.templating;

import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;

public class Template {

    private String name;
    private String source;
    private String description;
    private Map variables = new LinkedHashMap<>(); // Ordered

    private TemplateProcessor templateProcessor;

    public Template(String name, String source) throws ParseException {
        this.name = name;
        this.source = source;
        templateProcessor = new TemplateProcessor(source);
    }

    public String getName() {
        return name;
    }

    public String getSource() {
        return source;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Collection getVariables() {
        return variables.values();
    }

    public void addVariable(Variable variable) {
        variables.put(variable.getName(), variable);
    }

    public String process(Map args) {
        return templateProcessor.process(args);
    }

    @Override
    public String toString() {
        return name;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy