public TemplateBuilder(Template template) throws SparkplugException { this.version = template.getVersion(); this.templateRef = template.getTemplateRef(); this.isDefinition = template.isDefinition(); this.metrics = new ArrayList<Metric>(template.getMetrics().size()); for (Metric metric : template.getMetrics()) { this.metrics.add(new MetricBuilder(metric).createMetric()); } this.parameters = new ArrayList<Parameter>(template.getParameters().size()); for (Parameter parameter : template.getParameters()) { this.parameters.add(new Parameter(parameter.getName(), parameter.getType(), parameter.getValue())); } }
logger.trace( "Setting template - name: " + protoMetric.getName() + ", version: " + template.getVersion() + ", ref: " + template.getTemplateRef() + ", isDef: " + template.isDefinition() + ", metrics: " + metrics.size() + ", params: " + parameters.size());
if (template.getTemplateRef() != null) { templateBuilder.setTemplateRef(template.getTemplateRef());