public Template createTemplate() { return new Template(version, templateRef, isDefinition, metrics, parameters); } }
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())); } }
"Setting template - name: " + protoMetric.getName() + ", version: " + template.getVersion() + ", ref: " + template.getTemplateRef() + ", isDef: " + template.isDefinition() + ", metrics: " + metrics.size() + ", params: " + parameters.size());
templateBuilder.setIsDefinition(template.isDefinition()); if (template.getVersion() != null) { templateBuilder.setVersion(template.getVersion()); if (template.getTemplateRef() != null) { templateBuilder.setTemplateRef(template.getTemplateRef()); if (template.getMetrics() != null) { for (Metric templateMetric : template.getMetrics()) { templateBuilder.addMetrics(convertMetric(templateMetric)); if (template.getParameters() != null) { for (Parameter parameter : template.getParameters()) { templateBuilder.addParameters(convertParameter(parameter));