private SparkplugBPayloadBuilder addBdSeqNum(SparkplugBPayloadBuilder payload) throws Exception { if (payload == null) { payload = new SparkplugBPayloadBuilder(); } if (bdSeq == 256) { bdSeq = 0; } payload.addMetric(new MetricBuilder("bdSeq", Int64, (long) bdSeq).createMetric()); bdSeq++; return payload; }
public MetaDataBuilder(MetaData metaData) { this.isMultiPart = metaData.isMultiPart(); this.contentType = metaData.getContentType(); this.size = metaData.getSize(); this.seq = metaData.getSeq(); this.fileName = metaData.getFileName(); this.fileType = metaData.getFileType(); this.md5 = metaData.getMd5(); this.description = metaData.getDescription(); }
/** * Returns true if this topic's type matches the passes in type, false otherwise. * * @param type the type to check * @return true if this topic's type matches the passes in type, false otherwise */ public boolean isType(MessageType type) { return this.type != null && this.type.equals(type); }
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())); } }
public SparkplugBPayload createPayload() { return new SparkplugBPayload(timestamp, metrics, seq, uuid, body); } }
public Metric createMetric() throws SparkplugInvalidTypeException { return new Metric(name, alias, timestamp, dataType, isHistorical, isTransient, metaData, properties, value); } }
public PropertySet createPropertySet() { return new PropertySet(propertyMap); } }
public Row createRow() { return new Row(values); } }
public Template createTemplate() { return new Template(version, templateRef, isDefinition, metrics, parameters); } }
public Message build() { return new Message(this.topic, this.payload); } }
/** * A constructor. * * @param type the property type * @param value the property value * @throws SparkplugInvalidTypeException */ public PropertyValue(PropertyDataType type, Object value) throws SparkplugInvalidTypeException { this.type = type; this.value = value; isNull = (value == null) ? true : false; type.checkType(value); }
public MetaData createMetaData() { return new MetaData(isMultiPart, contentType, size, seq, fileName, fileType, md5, description); } }
/** * Constructs a Parameter instance. * * @param name The name of the parameter. * @param type The type of the parameter. * @param value The value of the parameter. * @throws SparkplugInvalidTypeException */ public Parameter(String name, ParameterDataType type, Object value) throws SparkplugInvalidTypeException { this.name = name; this.type = type; this.value = value; this.type.checkType(value); }
private SparkplugBPayloadBuilder addBdSeqNum(SparkplugBPayloadBuilder payload) throws Exception { if (payload == null) { payload = new SparkplugBPayloadBuilder(); } if (bdSeq == 256) { bdSeq = 0; } payload.addMetric(new MetricBuilder("bdSeq", Int64, (long)bdSeq).createMetric()); bdSeq++; return payload; }
private SparkplugBPayloadBuilder addBdSeqNum(SparkplugBPayloadBuilder payload) throws Exception { if (payload == null) { payload = new SparkplugBPayloadBuilder(); } if (bdSeq == 256) { bdSeq = 0; } payload.addMetric(new MetricBuilder("bdSeq", Int64, (long)bdSeq).createMetric()); bdSeq++; return payload; }