From 65138839de0b47540a9995c38d3cfeb08a16f685 Mon Sep 17 00:00:00 2001 From: wes-johnson Date: Fri, 26 Jan 2024 09:21:25 -0800 Subject: [PATCH 01/22] Upticked 3.x pom versions to v1.0.9-SNAPSHOT Signed-off-by: wes-johnson --- java/compat_impl/edge/pom.xml | 2 +- java/compat_impl/host/pom.xml | 2 +- java/examples/device_timestamp/pom.xml | 2 +- java/examples/edge_node_control/pom.xml | 2 +- java/examples/host_file/pom.xml | 2 +- java/examples/listener/pom.xml | 2 +- java/examples/pom.xml | 2 +- java/examples/raspberry_pi/pom.xml | 2 +- java/examples/records/pom.xml | 2 +- java/examples/simple/pom.xml | 2 +- java/examples/udt/pom.xml | 2 +- java/lib/core/pom.xml | 2 +- java/lib/edge/pom.xml | 2 +- java/lib/host/pom.xml | 2 +- java/pom.xml | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/java/compat_impl/edge/pom.xml b/java/compat_impl/edge/pom.xml index 1459b84..7c0c1b7 100644 --- a/java/compat_impl/edge/pom.xml +++ b/java/compat_impl/edge/pom.xml @@ -18,7 +18,7 @@ org.eclipse.tahu tahu - 1.0.8 + 1.0.9-SNAPSHOT ../../pom.xml diff --git a/java/compat_impl/host/pom.xml b/java/compat_impl/host/pom.xml index 1917f73..9285bfc 100644 --- a/java/compat_impl/host/pom.xml +++ b/java/compat_impl/host/pom.xml @@ -18,7 +18,7 @@ org.eclipse.tahu tahu - 1.0.8 + 1.0.9-SNAPSHOT ../../pom.xml diff --git a/java/examples/device_timestamp/pom.xml b/java/examples/device_timestamp/pom.xml index 2ce5652..d920f11 100644 --- a/java/examples/device_timestamp/pom.xml +++ b/java/examples/device_timestamp/pom.xml @@ -18,7 +18,7 @@ org.eclipse.tahu tahu-examples - 1.0.8 + 1.0.9-SNAPSHOT ../pom.xml diff --git a/java/examples/edge_node_control/pom.xml b/java/examples/edge_node_control/pom.xml index 7b4f5ce..e471e8b 100644 --- a/java/examples/edge_node_control/pom.xml +++ b/java/examples/edge_node_control/pom.xml @@ -18,7 +18,7 @@ org.eclipse.tahu tahu-examples - 1.0.8 + 1.0.9-SNAPSHOT ../pom.xml diff --git a/java/examples/host_file/pom.xml b/java/examples/host_file/pom.xml index 902c9a3..eccd380 100644 --- a/java/examples/host_file/pom.xml +++ b/java/examples/host_file/pom.xml @@ -18,7 +18,7 @@ org.eclipse.tahu tahu-examples - 1.0.8 + 1.0.9-SNAPSHOT ../pom.xml diff --git a/java/examples/listener/pom.xml b/java/examples/listener/pom.xml index 8794c33..dc8db36 100644 --- a/java/examples/listener/pom.xml +++ b/java/examples/listener/pom.xml @@ -18,7 +18,7 @@ org.eclipse.tahu tahu-examples - 1.0.8 + 1.0.9-SNAPSHOT ../pom.xml diff --git a/java/examples/pom.xml b/java/examples/pom.xml index 344c3af..a6a6202 100644 --- a/java/examples/pom.xml +++ b/java/examples/pom.xml @@ -29,7 +29,7 @@ org.eclipse.tahu tahu-examples - 1.0.8 + 1.0.9-SNAPSHOT pom Eclipse Tahu diff --git a/java/examples/raspberry_pi/pom.xml b/java/examples/raspberry_pi/pom.xml index 08f9b5e..6056b61 100644 --- a/java/examples/raspberry_pi/pom.xml +++ b/java/examples/raspberry_pi/pom.xml @@ -18,7 +18,7 @@ org.eclipse.tahu tahu-examples - 1.0.8 + 1.0.9-SNAPSHOT ../pom.xml diff --git a/java/examples/records/pom.xml b/java/examples/records/pom.xml index 57fb950..79add4f 100644 --- a/java/examples/records/pom.xml +++ b/java/examples/records/pom.xml @@ -18,7 +18,7 @@ org.eclipse.tahu tahu-examples - 1.0.8 + 1.0.9-SNAPSHOT ../pom.xml diff --git a/java/examples/simple/pom.xml b/java/examples/simple/pom.xml index 4603c60..befb330 100644 --- a/java/examples/simple/pom.xml +++ b/java/examples/simple/pom.xml @@ -18,7 +18,7 @@ org.eclipse.tahu tahu-examples - 1.0.8 + 1.0.9-SNAPSHOT ../pom.xml diff --git a/java/examples/udt/pom.xml b/java/examples/udt/pom.xml index 8517360..a889cc7 100644 --- a/java/examples/udt/pom.xml +++ b/java/examples/udt/pom.xml @@ -18,7 +18,7 @@ org.eclipse.tahu tahu-examples - 1.0.8 + 1.0.9-SNAPSHOT ../pom.xml diff --git a/java/lib/core/pom.xml b/java/lib/core/pom.xml index 9a6971e..a8581a8 100644 --- a/java/lib/core/pom.xml +++ b/java/lib/core/pom.xml @@ -18,7 +18,7 @@ org.eclipse.tahu tahu - 1.0.8 + 1.0.9-SNAPSHOT ../../pom.xml diff --git a/java/lib/edge/pom.xml b/java/lib/edge/pom.xml index 2a71406..986b7e7 100644 --- a/java/lib/edge/pom.xml +++ b/java/lib/edge/pom.xml @@ -18,7 +18,7 @@ org.eclipse.tahu tahu - 1.0.8 + 1.0.9-SNAPSHOT ../../pom.xml diff --git a/java/lib/host/pom.xml b/java/lib/host/pom.xml index d0baa83..6334017 100644 --- a/java/lib/host/pom.xml +++ b/java/lib/host/pom.xml @@ -18,7 +18,7 @@ org.eclipse.tahu tahu - 1.0.8 + 1.0.9-SNAPSHOT ../../pom.xml diff --git a/java/pom.xml b/java/pom.xml index acf5ed8..a22d596 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -31,7 +31,7 @@ org.eclipse.tahu tahu - 1.0.8 + 1.0.9-SNAPSHOT pom Eclipse Tahu From 271acf41500d90898b2583681c89433f27169f85 Mon Sep 17 00:00:00 2001 From: wes-johnson Date: Mon, 19 Feb 2024 14:42:45 -0800 Subject: [PATCH 02/22] Added host application controls for the STATE messages --- .../tahu/host/SparkplugHostApplication.java | 4 +- .../org/eclipse/tahu/mqtt/TahuClient.java | 165 +++++++++++------- .../org/eclipse/tahu/edge/EdgeClient.java | 2 +- .../eclipse/tahu/host/HostApplication.java | 25 ++- .../eclipse/tahu/host/TahuHostCallback.java | 29 ++- 5 files changed, 145 insertions(+), 80 deletions(-) diff --git a/java/compat_impl/host/src/main/java/org/eclipse/tahu/host/SparkplugHostApplication.java b/java/compat_impl/host/src/main/java/org/eclipse/tahu/host/SparkplugHostApplication.java index ba9f901..6821465 100644 --- a/java/compat_impl/host/src/main/java/org/eclipse/tahu/host/SparkplugHostApplication.java +++ b/java/compat_impl/host/src/main/java/org/eclipse/tahu/host/SparkplugHostApplication.java @@ -101,7 +101,7 @@ public SparkplugHostApplication() { try { hostApplication = new HostApplication(this, HOST_ID, new ArrayList<>(Arrays.asList(SparkplugMeta.SPARKPLUG_B_TOPIC_PREFIX + "/#")), - mqttServerDefinitions, null, new SparkplugBPayloadDecoder()); + mqttServerDefinitions, null, new SparkplugBPayloadDecoder(), true); } catch (Exception e) { logger.error("Failed to create the HostApplication", e); } @@ -110,7 +110,7 @@ public SparkplugHostApplication() { public void start() throws TahuException { commandListener = new CommandListener(hostApplication, COMMAND_LISTENER_DIRECTORY, COMMAND_LISTENER_POLL_RATE); commandListener.start(); - hostApplication.start(); + hostApplication.start(true); } public void shutdown() { diff --git a/java/lib/core/src/main/java/org/eclipse/tahu/mqtt/TahuClient.java b/java/lib/core/src/main/java/org/eclipse/tahu/mqtt/TahuClient.java index 49516c6..b11a402 100644 --- a/java/lib/core/src/main/java/org/eclipse/tahu/mqtt/TahuClient.java +++ b/java/lib/core/src/main/java/org/eclipse/tahu/mqtt/TahuClient.java @@ -141,9 +141,12 @@ public class TahuClient implements MqttCallbackExtended { private boolean firstConnection = true; private boolean resubscribed = false; + // Whether or not the BIRTH should be published on connect and controls the STATE of the client + private boolean onlineState; + public TahuClient(final MqttClientId clientId, final MqttServerName mqttServerName, final MqttServerUrl mqttServerUrl, final String username, final String password, boolean cleanSession, - int keepAlive, ClientCallback callback, RandomStartupDelay randomStartupDelay) { + int keepAlive, ClientCallback callback, RandomStartupDelay randomStartupDelay, boolean onlineState) { this.mqttServerUrl = mqttServerUrl; this.mqttServerName = mqttServerName; this.clientId = clientId; @@ -161,25 +164,27 @@ public TahuClient(final MqttClientId clientId, final MqttServerName mqttServerNa this.renewDisconnectTime(); this.renewOnlineDate(); this.renewOfflineDate(); + this.onlineState = onlineState; } public TahuClient(final MqttClientId clientId, final MqttServerName mqttServerName, final MqttServerUrl mqttServerUrl, String username, String password, boolean cleanSession, int keepAlive, ClientCallback callback, RandomStartupDelay randomStartupDelay, boolean useSparkplugStatePayload, - String birthTopic, byte[] birthPayload, String lwtTopic, byte[] lwtPayload, int lwtQoS) { + String birthTopic, byte[] birthPayload, String lwtTopic, byte[] lwtPayload, int lwtQoS, + boolean onlineState) { this(clientId, mqttServerName, mqttServerUrl, username, password, cleanSession, keepAlive, callback, - randomStartupDelay); + randomStartupDelay, onlineState); this.setLifecycleProps(useSparkplugStatePayload, birthTopic, birthPayload, false, lwtTopic, lwtPayload, lwtQoS, false); } public TahuClient(final MqttClientId clientId, final MqttServerName mqttServerName, final MqttServerUrl mqttServerUrl, String username, String password, boolean cleanSession, int keepAlive, - ClientCallback callback, RandomStartupDelay randomStartupDelay, boolean useSparkplugStatePayload, - String birthTopic, byte[] birthPayload, boolean birthRetain, String lwtTopic, byte[] lwtPayload, int lwtQoS, - boolean lwtRetain) { + ClientCallback callback, RandomStartupDelay randomStartupDelay, boolean onlineState, + boolean useSparkplugStatePayload, String birthTopic, byte[] birthPayload, boolean birthRetain, + String lwtTopic, byte[] lwtPayload, int lwtQoS, boolean lwtRetain) { this(clientId, mqttServerName, mqttServerUrl, username, password, cleanSession, keepAlive, callback, - randomStartupDelay); + randomStartupDelay, onlineState); this.setLifecycleProps(useSparkplugStatePayload, birthTopic, birthPayload, birthRetain, lwtTopic, lwtPayload, lwtQoS, lwtRetain); } @@ -716,43 +721,8 @@ public void disconnect(long disconnectQuieseTime, long disconnectTimeout, boolea if (client != null) { try { - boolean clientConnected = client.isConnected(); - boolean lwtDeliveryComplete = false; - if (publishLwt && lwtTopic != null && clientConnected) { - logger.info("{}: Publishing LWT on {} with qos={} and retain={}", getClientId(), lwtTopic, - lwtQoS, lwtRetain); - synchronized (lwtDeliveryLock) { - /* - * Synchronization with the deliveryComplete() callback is needed to ensure that - * the publish() call is fully completed and the lwtDeliveryToken is set before - * it is being nullified in the Paho callback. - */ - if (useSparkplugStatePayload) { - try { - ObjectMapper mapper = new ObjectMapper(); - StatePayload statePayload = new StatePayload(false, new Date().getTime()); - byte[] payload = mapper.writeValueAsString(statePayload).getBytes(); - lwtDeliveryToken = publish(lwtTopic, payload, lwtQoS, lwtRetain); - } catch (Exception e) { - logger.error("{}: Failed to publish the LWT message on {}", getClientId(), lwtTopic, - e); - } - } else { - lwtDeliveryToken = publish(lwtTopic, lwtPayload, lwtQoS, lwtRetain); - } - logger.debug("{}: published on LWT Topic={}, messageId={}", getClientId(), lwtTopic, - lwtDeliveryToken.getMessageId()); - } - - if (waitForLwt) { - lwtDeliveryComplete = isLwtDeliveryComplete(); - logger.trace("{}: Completed LWT Delivery? {}", getClientId(), lwtDeliveryComplete); - } else { - logger.trace("{}: Not waiting for LWT", getClientId()); - } - } else { - logger.debug("{}: Not publishing LWT, client connected state: {}", getClientId(), - clientConnected); + if (publishLwt) { + this.publishLwt(waitForLwt); } // FIXME - remove This sleep is necessary due to: @@ -1328,7 +1298,15 @@ public void onFailure(IMqttToken asyncActionToken, Throwable exception) { resubscribed = true; // Publish a standard Birth/Death Certificate if a baseTopic has been defined. - publishBirthMessage(); + if (onlineState) { + publishBirthMessage(); + } else { + try { + this.publishLwt(true); + } catch (Exception e) { + logger.error("Failed to publish the LWT", e); + } + } firstConnection = false; } @@ -1345,33 +1323,96 @@ public void setTrackFirstConnection(boolean trackFirstConnection) { } } - public void publishBirthMessage() { - if (birthTopic != null) { - try { - logger.debug("{}: Publishing BIRTH on {} with retain {}", getClientId(), birthTopic, birthRetain); - if (useSparkplugStatePayload) { + public void setOnlineState(boolean newOnlineState) { + synchronized (clientLock) { + if (this.onlineState == newOnlineState) { + return; + } else { + this.onlineState = newOnlineState; + + if (onlineState) { + publishBirthMessage(); + } else { try { - ObjectMapper mapper = new ObjectMapper(); - StatePayload statePayload = new StatePayload(true, lastStateDeathPayloadTimestamp); - byte[] payload = mapper.writeValueAsString(statePayload).getBytes(); - publish(birthTopic, payload, MqttOperatorDefs.QOS1, birthRetain); + this.publishLwt(true); } catch (Exception e) { - logger.error("{}: Failed to publish the BIRTH message on {}", getClientId(), birthTopic, e); + logger.error("Failed to publish the LWT when setting the online state", e); } - } else { - publish(birthTopic, birthPayload, MqttOperatorDefs.QOS1, birthRetain); } - } catch (TahuException ce) { - logger.error("{}: Error in birth topic publish on connect", getClientId(), ce); + } + } + } + + public void publishBirthMessage() { + synchronized (clientLock) { + if (birthTopic != null && client.isConnected()) { try { - client.disconnectForcibly(0, 1, false); - } catch (Exception e) { - logger.error("{}: Failed to disconnect after failed BIRTH publish", getClientId(), e); + logger.debug("{}: Publishing BIRTH on {} with retain {}", getClientId(), birthTopic, birthRetain); + if (useSparkplugStatePayload) { + try { + ObjectMapper mapper = new ObjectMapper(); + StatePayload statePayload = new StatePayload(true, lastStateDeathPayloadTimestamp); + byte[] payload = mapper.writeValueAsString(statePayload).getBytes(); + publish(birthTopic, payload, MqttOperatorDefs.QOS1, birthRetain); + } catch (Exception e) { + logger.error("{}: Failed to publish the BIRTH message on {}", getClientId(), birthTopic, e); + } + } else { + publish(birthTopic, birthPayload, MqttOperatorDefs.QOS1, birthRetain); + } + } catch (TahuException ce) { + logger.error("{}: Error in birth topic publish on connect", getClientId(), ce); + try { + client.disconnectForcibly(0, 1, false); + } catch (Exception e) { + logger.error("{}: Failed to disconnect after failed BIRTH publish", getClientId(), e); + } } } } } + public void publishLwt(boolean waitForLwt) throws MqttException, TahuException { + synchronized (clientLock) { + boolean clientConnected = client.isConnected(); + boolean lwtDeliveryComplete = false; + if (lwtTopic != null && clientConnected) { + logger.info("{}: Publishing LWT on {} with qos={} and retain={}", getClientId(), lwtTopic, lwtQoS, + lwtRetain); + synchronized (lwtDeliveryLock) { + /* + * Synchronization with the deliveryComplete() callback is needed to ensure that + * the publish() call is fully completed and the lwtDeliveryToken is set before + * it is being nullified in the Paho callback. + */ + if (useSparkplugStatePayload) { + try { + ObjectMapper mapper = new ObjectMapper(); + StatePayload statePayload = new StatePayload(false, new Date().getTime()); + byte[] payload = mapper.writeValueAsString(statePayload).getBytes(); + lwtDeliveryToken = publish(lwtTopic, payload, lwtQoS, lwtRetain); + } catch (Exception e) { + logger.error("{}: Failed to publish the LWT message on {}", getClientId(), lwtTopic, e); + } + } else { + lwtDeliveryToken = publish(lwtTopic, lwtPayload, lwtQoS, lwtRetain); + } + logger.debug("{}: published on LWT Topic={}, messageId={}", getClientId(), lwtTopic, + lwtDeliveryToken.getMessageId()); + } + + if (waitForLwt) { + lwtDeliveryComplete = isLwtDeliveryComplete(); + logger.trace("{}: Completed LWT Delivery? {}", getClientId(), lwtDeliveryComplete); + } else { + logger.trace("{}: Not waiting for LWT", getClientId()); + } + } else { + logger.debug("{}: Not publishing LWT, client connected state: {}", getClientId(), clientConnected); + } + } + } + private Date getConnectTime() { return this.connectTime; } diff --git a/java/lib/edge/src/main/java/org/eclipse/tahu/edge/EdgeClient.java b/java/lib/edge/src/main/java/org/eclipse/tahu/edge/EdgeClient.java index 59a0baf..e299be6 100644 --- a/java/lib/edge/src/main/java/org/eclipse/tahu/edge/EdgeClient.java +++ b/java/lib/edge/src/main/java/org/eclipse/tahu/edge/EdgeClient.java @@ -424,7 +424,7 @@ private boolean connectToTargetServer() { tahuClient = new TahuClient(mqttClientId, mqttServerDefinition.getMqttServerName(), mqttServerDefinition.getMqttServerUrl(), mqttServerDefinition.getUsername(), mqttServerDefinition.getPassword(), true, mqttServerDefinition.getKeepAliveTimeout(), callback, - randomStartupDelay, false, null, null, false, deathTopic.toString(), deathPayloadBytes, 1, + randomStartupDelay, true, false, null, null, false, deathTopic.toString(), deathPayloadBytes, 1, false); tahuClient.setTrackFirstConnection(true); tahuClient.setAutoReconnect(false); diff --git a/java/lib/host/src/main/java/org/eclipse/tahu/host/HostApplication.java b/java/lib/host/src/main/java/org/eclipse/tahu/host/HostApplication.java index aba2bea..97c90e5 100644 --- a/java/lib/host/src/main/java/org/eclipse/tahu/host/HostApplication.java +++ b/java/lib/host/src/main/java/org/eclipse/tahu/host/HostApplication.java @@ -50,7 +50,7 @@ public class HostApplication implements CommandPublisher { public HostApplication(HostApplicationEventHandler eventHandler, String hostId, List sparkplugSubscriptons, List mqttServerDefinitions, RandomStartupDelay randomStartupDelay, - PayloadDecoder payloadDecoder) { + PayloadDecoder payloadDecoder, boolean onlineState) { logger.info("Creating the Host Application"); if (hostId != null) { @@ -67,7 +67,7 @@ public HostApplication(HostApplicationEventHandler eventHandler, String hostId, SequenceReorderManager sequenceReorderManager = SequenceReorderManager.getInstance(); sequenceReorderManager.init(eventHandler, this, payloadDecoder, 5000L); this.tahuHostCallback = - new TahuHostCallback(eventHandler, this, sequenceReorderManager, payloadDecoder, hostId); + new TahuHostCallback(eventHandler, this, sequenceReorderManager, payloadDecoder, hostId, onlineState); } public HostApplication(HostApplicationEventHandler eventHandler, String hostId, List sparkplugSubscriptons, @@ -90,7 +90,7 @@ public HostApplication(HostApplicationEventHandler eventHandler, String hostId, this.randomStartupDelay = randomStartupDelay; } - public void start() { + public void start(boolean onlineState) { if (mqttServerDefinitions != null) { for (MqttServerDefinition mqttServerDefinition : mqttServerDefinitions) { logger.debug("Starting up the MQTT Client to {}", mqttServerDefinition.getMqttServerName()); @@ -99,8 +99,8 @@ public void start() { tahuClient = new TahuClient(mqttServerDefinition.getMqttClientId(), mqttServerDefinition.getMqttServerName(), mqttServerDefinition.getMqttServerUrl(), mqttServerDefinition.getUsername(), mqttServerDefinition.getPassword(), true, - mqttServerDefinition.getKeepAliveTimeout(), tahuHostCallback, randomStartupDelay, true, - stateTopic, null, true, stateTopic, null, MqttOperatorDefs.QOS1, true); + mqttServerDefinition.getKeepAliveTimeout(), tahuHostCallback, randomStartupDelay, + onlineState, true, stateTopic, null, true, stateTopic, null, MqttOperatorDefs.QOS1, true); } // Add it to the Map @@ -143,8 +143,6 @@ private void startClient(TahuClient tahuClient) { return; } } - - // Pub } catch (Exception e) { logger.error("Failed to start client {} connecting to {}", tahuClient.getClientId(), tahuClient.getMqttServerUrl(), e); @@ -195,6 +193,19 @@ public void shutdown() { } } + /** + * Whether or not the host should be marked as online This should be set to false if the host is not ready to + * receive Sparkplug messages + * + * @param onlineState the state to set + */ + public void setOnlineState(boolean onlineState) { + tahuHostCallback.setOnlineState(onlineState); + for (TahuClient tahuClient : tahuClients.values()) { + tahuClient.setOnlineState(onlineState); + } + } + public String getHostId() { return hostId; } diff --git a/java/lib/host/src/main/java/org/eclipse/tahu/host/TahuHostCallback.java b/java/lib/host/src/main/java/org/eclipse/tahu/host/TahuHostCallback.java index bc1905d..3523e7e 100644 --- a/java/lib/host/src/main/java/org/eclipse/tahu/host/TahuHostCallback.java +++ b/java/lib/host/src/main/java/org/eclipse/tahu/host/TahuHostCallback.java @@ -61,9 +61,11 @@ public class TahuHostCallback implements ClientCallback { private final String hostId; + private boolean onlineState; + public TahuHostCallback(HostApplicationEventHandler eventHandler, CommandPublisher commandPublisher, SequenceReorderManager sequenceReorderManager, PayloadDecoder payloadDecoder, - String hostId) { + String hostId, boolean onlineState) { this.eventHandler = eventHandler; this.commandPublisher = commandPublisher; if (sequenceReorderManager != null) { @@ -76,6 +78,7 @@ public TahuHostCallback(HostApplicationEventHandler eventHandler, CommandPublish } this.payloadDecoder = payloadDecoder; this.hostId = hostId; + this.onlineState = onlineState; this.sparkplugBExecutors = new ThreadPoolExecutor[DEFAULT_NUM_OF_THREADS]; for (int i = 0; i < DEFAULT_NUM_OF_THREADS; i++) { @@ -107,6 +110,10 @@ public void setMqttClients(Map tahuClients) { this.tahuClients = tahuClients; } + public void setOnlineState(boolean onlineState) { + this.onlineState = onlineState; + } + @Override public void messageArrived(MqttServerName server, MqttServerUrl url, MqttClientId clientId, String topic, MqttMessage message) { @@ -141,13 +148,19 @@ public void messageArrived(MqttServerName server, MqttServerUrl url, MqttClientI // This is a STATE message - handle as needed ObjectMapper mapper = new ObjectMapper(); StatePayload statePayload = mapper.readValue(new String(message.getPayload()), StatePayload.class); - if (hostId != null && !hostId.trim().isEmpty() && splitTopic[2].equals(hostId) - && !statePayload.isOnline()) { - // Make sure this isn't an OFFLINE message - logger.info( - "This is a offline STATE message from {} - correcting with new online STATE message", - splitTopic[2]); - client.publishBirthMessage(); + if (hostId != null && !hostId.trim().isEmpty() && splitTopic[2].equals(hostId)) { + // Correct the state if it is not correct + if (!statePayload.isOnline() && onlineState) { + logger.info( + "This is a offline STATE message from {} - correcting with new online STATE message", + splitTopic[2]); + client.publishBirthMessage(); + } else if (statePayload.isOnline() && !onlineState) { + logger.info( + "This is a online STATE message from {} - correcting with new offline STATE message", + splitTopic[2]); + client.publishLwt(true); + } } } else { // Get the proper executor From c95d531ede6aa81791feb02d3ae53b54072d1dc4 Mon Sep 17 00:00:00 2001 From: wes-johnson Date: Wed, 21 Feb 2024 14:54:37 -0800 Subject: [PATCH 03/22] [BUILD] Upticked commons-compress dep from 1.21 to 1.26.0 --- java/lib/core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/lib/core/pom.xml b/java/lib/core/pom.xml index a8581a8..0ad4416 100644 --- a/java/lib/core/pom.xml +++ b/java/lib/core/pom.xml @@ -35,7 +35,7 @@ org.apache.commons commons-compress - 1.21 + 1.26.0 From 8e1524c3bcab9e3ef08e5a1fd3cb67c869963c22 Mon Sep 17 00:00:00 2001 From: wes-johnson Date: Thu, 7 Mar 2024 15:38:38 -0800 Subject: [PATCH 04/22] Updated Java protobuf version to 3.25.3 and compiled the base lib using protoc version 'libprotoc 25.3' --- java/lib/core/readme.txt | 3 +- .../tahu/protobuf/SparkplugBProto.java | 7441 ++++++++++------- java/pom.xml | 2 +- 3 files changed, 4328 insertions(+), 3118 deletions(-) diff --git a/java/lib/core/readme.txt b/java/lib/core/readme.txt index 24a3ad3..60c8700 100644 --- a/java/lib/core/readme.txt +++ b/java/lib/core/readme.txt @@ -1,2 +1,3 @@ # To generate the base protobuf sparkplug_b Java library -protoc --proto_path=../../ --java_out=src/main/java ../../sparkplug_b/sparkplug_b.proto +cd ~/dev/gitflow/Tahu/java/lib/core +protoc --proto_path=../../../sparkplug_b/ --java_out=src/main/java ../../../sparkplug_b/sparkplug_b.proto diff --git a/java/lib/core/src/main/java/org/eclipse/tahu/protobuf/SparkplugBProto.java b/java/lib/core/src/main/java/org/eclipse/tahu/protobuf/SparkplugBProto.java index 52e5562..5537398 100644 --- a/java/lib/core/src/main/java/org/eclipse/tahu/protobuf/SparkplugBProto.java +++ b/java/lib/core/src/main/java/org/eclipse/tahu/protobuf/SparkplugBProto.java @@ -1,6 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: sparkplug_b/sparkplug_b.proto +// source: sparkplug_b.proto +// Protobuf Java Version: 3.25.3 package org.eclipse.tahu.protobuf; public final class SparkplugBProto { @@ -352,6 +353,8 @@ public final int getNumber() { } /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. * @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated @@ -359,6 +362,10 @@ public static DataType valueOf(int value) { return forNumber(value); } + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ public static DataType forNumber(int value) { switch (value) { case 0: return Unknown; @@ -456,6 +463,7 @@ public interface PayloadOrBuilder extends * * * optional uint64 timestamp = 1; + * @return Whether the timestamp field is set. */ boolean hasTimestamp(); /** @@ -464,6 +472,7 @@ public interface PayloadOrBuilder extends * * * optional uint64 timestamp = 1; + * @return The timestamp. */ long getTimestamp(); @@ -517,6 +526,7 @@ org.eclipse.tahu.protobuf.SparkplugBProto.Payload.MetricOrBuilder getMetricsOrBu * * * optional uint64 seq = 3; + * @return Whether the seq field is set. */ boolean hasSeq(); /** @@ -525,6 +535,7 @@ org.eclipse.tahu.protobuf.SparkplugBProto.Payload.MetricOrBuilder getMetricsOrBu * * * optional uint64 seq = 3; + * @return The seq. */ long getSeq(); @@ -534,6 +545,7 @@ org.eclipse.tahu.protobuf.SparkplugBProto.Payload.MetricOrBuilder getMetricsOrBu * * * optional string uuid = 4; + * @return Whether the uuid field is set. */ boolean hasUuid(); /** @@ -542,6 +554,7 @@ org.eclipse.tahu.protobuf.SparkplugBProto.Payload.MetricOrBuilder getMetricsOrBu * * * optional string uuid = 4; + * @return The uuid. */ java.lang.String getUuid(); /** @@ -550,6 +563,7 @@ org.eclipse.tahu.protobuf.SparkplugBProto.Payload.MetricOrBuilder getMetricsOrBu * * * optional string uuid = 4; + * @return The bytes for uuid. */ com.google.protobuf.ByteString getUuidBytes(); @@ -560,6 +574,7 @@ org.eclipse.tahu.protobuf.SparkplugBProto.Payload.MetricOrBuilder getMetricsOrBu * * * optional bytes body = 5; + * @return Whether the body field is set. */ boolean hasBody(); /** @@ -568,107 +583,42 @@ org.eclipse.tahu.protobuf.SparkplugBProto.Payload.MetricOrBuilder getMetricsOrBu * * * optional bytes body = 5; + * @return The body. */ com.google.protobuf.ByteString getBody(); } /** * Protobuf type {@code org.eclipse.tahu.protobuf.Payload} */ - public static final class Payload extends + public static final class Payload extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage< Payload> implements // @@protoc_insertion_point(message_implements:org.eclipse.tahu.protobuf.Payload) PayloadOrBuilder { + private static final long serialVersionUID = 0L; // Use Payload.newBuilder() to construct. private Payload(com.google.protobuf.GeneratedMessageV3.ExtendableBuilder builder) { super(builder); } private Payload() { - timestamp_ = 0L; metrics_ = java.util.Collections.emptyList(); - seq_ = 0L; uuid_ = ""; body_ = com.google.protobuf.ByteString.EMPTY; } @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Payload( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - timestamp_ = input.readUInt64(); - break; - } - case 18: { - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - metrics_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000002; - } - metrics_.add( - input.readMessage(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Metric.PARSER, extensionRegistry)); - break; - } - case 24: { - bitField0_ |= 0x00000002; - seq_ = input.readUInt64(); - break; - } - case 34: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000004; - uuid_ = bs; - break; - } - case 42: { - bitField0_ |= 0x00000008; - body_ = input.readBytes(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - metrics_ = java.util.Collections.unmodifiableList(metrics_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new Payload(); } + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_descriptor; } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_fieldAccessorTable @@ -687,6 +637,7 @@ public interface TemplateOrBuilder extends * * * optional string version = 1; + * @return Whether the version field is set. */ boolean hasVersion(); /** @@ -695,6 +646,7 @@ public interface TemplateOrBuilder extends * * * optional string version = 1; + * @return The version. */ java.lang.String getVersion(); /** @@ -703,6 +655,7 @@ public interface TemplateOrBuilder extends * * * optional string version = 1; + * @return The bytes for version. */ com.google.protobuf.ByteString getVersionBytes(); @@ -777,47 +730,53 @@ org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.ParameterOrBuilder ge /** *
-       * Reference to a template if this is extending a Template or an instance - must exist if an instance
+       * MUST be a reference to a template definition if this is an instance (i.e. the name of the template definition) - MUST be omitted for template definitions
        * 
* * optional string template_ref = 4; + * @return Whether the templateRef field is set. */ boolean hasTemplateRef(); /** *
-       * Reference to a template if this is extending a Template or an instance - must exist if an instance
+       * MUST be a reference to a template definition if this is an instance (i.e. the name of the template definition) - MUST be omitted for template definitions
        * 
* * optional string template_ref = 4; + * @return The templateRef. */ java.lang.String getTemplateRef(); /** *
-       * Reference to a template if this is extending a Template or an instance - must exist if an instance
+       * MUST be a reference to a template definition if this is an instance (i.e. the name of the template definition) - MUST be omitted for template definitions
        * 
* * optional string template_ref = 4; + * @return The bytes for templateRef. */ com.google.protobuf.ByteString getTemplateRefBytes(); /** * optional bool is_definition = 5; + * @return Whether the isDefinition field is set. */ boolean hasIsDefinition(); /** * optional bool is_definition = 5; + * @return The isDefinition. */ boolean getIsDefinition(); } /** * Protobuf type {@code org.eclipse.tahu.protobuf.Payload.Template} */ - public static final class Template extends + public static final class Template extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage< Template> implements // @@protoc_insertion_point(message_implements:org.eclipse.tahu.protobuf.Payload.Template) TemplateOrBuilder { + private static final long serialVersionUID = 0L; // Use Template.newBuilder() to construct. private Template(com.google.protobuf.GeneratedMessageV3.ExtendableBuilder builder) { super(builder); @@ -827,95 +786,21 @@ private Template() { metrics_ = java.util.Collections.emptyList(); parameters_ = java.util.Collections.emptyList(); templateRef_ = ""; - isDefinition_ = false; } @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Template( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - version_ = bs; - break; - } - case 18: { - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - metrics_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000002; - } - metrics_.add( - input.readMessage(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Metric.PARSER, extensionRegistry)); - break; - } - case 26: { - if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - parameters_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000004; - } - parameters_.add( - input.readMessage(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.PARSER, extensionRegistry)); - break; - } - case 34: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - templateRef_ = bs; - break; - } - case 40: { - bitField0_ |= 0x00000004; - isDefinition_ = input.readBool(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - metrics_ = java.util.Collections.unmodifiableList(metrics_); - } - if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - parameters_ = java.util.Collections.unmodifiableList(parameters_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new Template(); } + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_Template_descriptor; } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_Template_fieldAccessorTable @@ -929,218 +814,150 @@ public interface ParameterOrBuilder extends /** * optional string name = 1; + * @return Whether the name field is set. */ boolean hasName(); /** * optional string name = 1; + * @return The name. */ java.lang.String getName(); /** * optional string name = 1; + * @return The bytes for name. */ com.google.protobuf.ByteString getNameBytes(); /** * optional uint32 type = 2; + * @return Whether the type field is set. */ boolean hasType(); /** * optional uint32 type = 2; + * @return The type. */ int getType(); /** - * optional uint32 int_value = 3; + * uint32 int_value = 3; + * @return Whether the intValue field is set. */ boolean hasIntValue(); /** - * optional uint32 int_value = 3; + * uint32 int_value = 3; + * @return The intValue. */ int getIntValue(); /** - * optional uint64 long_value = 4; + * uint64 long_value = 4; + * @return Whether the longValue field is set. */ boolean hasLongValue(); /** - * optional uint64 long_value = 4; + * uint64 long_value = 4; + * @return The longValue. */ long getLongValue(); /** - * optional float float_value = 5; + * float float_value = 5; + * @return Whether the floatValue field is set. */ boolean hasFloatValue(); /** - * optional float float_value = 5; + * float float_value = 5; + * @return The floatValue. */ float getFloatValue(); /** - * optional double double_value = 6; + * double double_value = 6; + * @return Whether the doubleValue field is set. */ boolean hasDoubleValue(); /** - * optional double double_value = 6; + * double double_value = 6; + * @return The doubleValue. */ double getDoubleValue(); /** - * optional bool boolean_value = 7; + * bool boolean_value = 7; + * @return Whether the booleanValue field is set. */ boolean hasBooleanValue(); /** - * optional bool boolean_value = 7; + * bool boolean_value = 7; + * @return The booleanValue. */ boolean getBooleanValue(); /** - * optional string string_value = 8; + * string string_value = 8; + * @return Whether the stringValue field is set. */ boolean hasStringValue(); /** - * optional string string_value = 8; + * string string_value = 8; + * @return The stringValue. */ java.lang.String getStringValue(); /** - * optional string string_value = 8; + * string string_value = 8; + * @return The bytes for stringValue. */ com.google.protobuf.ByteString getStringValueBytes(); /** - * optional .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * @return Whether the extensionValue field is set. */ boolean hasExtensionValue(); /** - * optional .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * @return The extensionValue. */ org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension getExtensionValue(); /** - * optional .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; */ org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtensionOrBuilder getExtensionValueOrBuilder(); - public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ValueCase getValueCase(); + org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ValueCase getValueCase(); } /** * Protobuf type {@code org.eclipse.tahu.protobuf.Payload.Template.Parameter} */ - public static final class Parameter extends + public static final class Parameter extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:org.eclipse.tahu.protobuf.Payload.Template.Parameter) ParameterOrBuilder { + private static final long serialVersionUID = 0L; // Use Parameter.newBuilder() to construct. private Parameter(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); } private Parameter() { name_ = ""; - type_ = 0; } @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Parameter( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - name_ = bs; - break; - } - case 16: { - bitField0_ |= 0x00000002; - type_ = input.readUInt32(); - break; - } - case 24: { - valueCase_ = 3; - value_ = input.readUInt32(); - break; - } - case 32: { - valueCase_ = 4; - value_ = input.readUInt64(); - break; - } - case 45: { - valueCase_ = 5; - value_ = input.readFloat(); - break; - } - case 49: { - valueCase_ = 6; - value_ = input.readDouble(); - break; - } - case 56: { - valueCase_ = 7; - value_ = input.readBool(); - break; - } - case 66: { - com.google.protobuf.ByteString bs = input.readBytes(); - valueCase_ = 8; - value_ = bs; - break; - } - case 74: { - org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension.Builder subBuilder = null; - if (valueCase_ == 9) { - subBuilder = ((org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension) value_).toBuilder(); - } - value_ = - input.readMessage(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom((org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension) value_); - value_ = subBuilder.buildPartial(); - } - valueCase_ = 9; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new Parameter(); } + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_Template_Parameter_descriptor; } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_Template_Parameter_fieldAccessorTable @@ -1156,11 +973,12 @@ public interface ParameterValueExtensionOrBuilder extends /** * Protobuf type {@code org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension} */ - public static final class ParameterValueExtension extends + public static final class ParameterValueExtension extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage< ParameterValueExtension> implements // @@protoc_insertion_point(message_implements:org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension) ParameterValueExtensionOrBuilder { + private static final long serialVersionUID = 0L; // Use ParameterValueExtension.newBuilder() to construct. private ParameterValueExtension(com.google.protobuf.GeneratedMessageV3.ExtendableBuilder builder) { super(builder); @@ -1169,49 +987,18 @@ private ParameterValueExtension() { } @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private ParameterValueExtension( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ParameterValueExtension(); } + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_Template_Parameter_ParameterValueExtension_descriptor; } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_Template_Parameter_ParameterValueExtension_fieldAccessorTable @@ -1220,6 +1007,7 @@ private ParameterValueExtension( } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -1233,27 +1021,28 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { com.google.protobuf.GeneratedMessageV3 .ExtendableMessage.ExtensionWriter extensionWriter = newExtensionWriter(); extensionWriter.writeUntil(536870912, output); - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; size += extensionsSerializedSize(); - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } - private static final long serialVersionUID = 0L; @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { @@ -1264,11 +1053,10 @@ public boolean equals(final java.lang.Object obj) { } org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension other = (org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension) obj; - boolean result = true; - result = result && unknownFields.equals(other.unknownFields); - result = result && - getExtensionFields().equals(other.getExtensionFields()); - return result; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!getExtensionFields().equals(other.getExtensionFields())) + return false; + return true; } @java.lang.Override @@ -1277,13 +1065,24 @@ public int hashCode() { return memoizedHashCode; } int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); + hash = (19 * hash) + getDescriptor().hashCode(); hash = hashFields(hash, getExtensionFields()); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } + public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -1317,11 +1116,13 @@ public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Paramet return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } + public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } + public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -1343,6 +1144,7 @@ public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Paramet .parseWithIOException(PARSER, input, extensionRegistry); } + @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); @@ -1350,6 +1152,7 @@ public static Builder newBuilder() { public static Builder newBuilder(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } + @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); @@ -1374,6 +1177,7 @@ public static final class Builder extends return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_Template_Parameter_ParameterValueExtension_descriptor; } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_Template_Parameter_ParameterValueExtension_fieldAccessorTable @@ -1383,33 +1187,32 @@ public static final class Builder extends // Construct using org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } + @java.lang.Override public Builder clear() { super.clear(); return this; } + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_Template_Parameter_ParameterValueExtension_descriptor; } + @java.lang.Override public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension getDefaultInstanceForType() { return org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension.getDefaultInstance(); } + @java.lang.Override public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension build() { org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension result = buildPartial(); if (!result.isInitialized()) { @@ -1418,61 +1221,73 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.Para return result; } + @java.lang.Override public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension buildPartial() { org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension result = new org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension(this); onBuilt(); return result; } + @java.lang.Override public Builder clone() { - return (Builder) super.clone(); + return super.clone(); } + @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); + java.lang.Object value) { + return super.setField(field, value); } + @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); + return super.clearField(field); } + @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); + return super.clearOneof(oneof); } + @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); } + @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); + java.lang.Object value) { + return super.addRepeatedField(field, value); } + @java.lang.Override public Builder setExtension( com.google.protobuf.GeneratedMessage.GeneratedExtension< org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension, Type> extension, Type value) { - return (Builder) super.setExtension(extension, value); + return super.setExtension(extension, value); } + @java.lang.Override public Builder setExtension( com.google.protobuf.GeneratedMessage.GeneratedExtension< org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension, java.util.List> extension, int index, Type value) { - return (Builder) super.setExtension(extension, index, value); + return super.setExtension(extension, index, value); } + @java.lang.Override public Builder addExtension( com.google.protobuf.GeneratedMessage.GeneratedExtension< org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension, java.util.List> extension, Type value) { - return (Builder) super.addExtension(extension, value); + return super.addExtension(extension, value); } - public Builder clearExtension( + @java.lang.Override + public Builder clearExtension( com.google.protobuf.GeneratedMessage.GeneratedExtension< - org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension, ?> extension) { - return (Builder) super.clearExtension(extension); + org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension, T> extension) { + return super.clearExtension(extension); } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension) { return mergeFrom((org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension)other); @@ -1485,11 +1300,12 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension other) { if (other == org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension.getDefaultInstance()) return this; this.mergeExtensionFields(other); - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (!extensionsAreInitialized()) { return false; @@ -1497,28 +1313,44 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } + @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); @@ -1540,11 +1372,23 @@ public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Paramet @java.lang.Deprecated public static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override public ParameterValueExtension parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ParameterValueExtension(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -1557,6 +1401,7 @@ public com.google.protobuf.Parser getParserForType() { return PARSER; } + @java.lang.Override public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension getDefaultInstanceForType() { return DEFAULT_INSTANCE; } @@ -1565,9 +1410,11 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.Para private int bitField0_; private int valueCase_ = 0; + @SuppressWarnings("serial") private java.lang.Object value_; public enum ValueCase - implements com.google.protobuf.Internal.EnumLite { + implements com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { INT_VALUE(3), LONG_VALUE(4), FLOAT_VALUE(5), @@ -1581,6 +1428,8 @@ private ValueCase(int value) { this.value = value; } /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. * @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated @@ -1613,16 +1462,21 @@ public int getNumber() { } public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; /** * optional string name = 1; + * @return Whether the name field is set. */ + @java.lang.Override public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); + return ((bitField0_ & 0x00000001) != 0); } /** * optional string name = 1; + * @return The name. */ + @java.lang.Override public java.lang.String getName() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { @@ -1639,7 +1493,9 @@ public java.lang.String getName() { } /** * optional string name = 1; + * @return The bytes for name. */ + @java.lang.Override public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; @@ -1655,30 +1511,38 @@ public java.lang.String getName() { } public static final int TYPE_FIELD_NUMBER = 2; - private int type_; + private int type_ = 0; /** * optional uint32 type = 2; + * @return Whether the type field is set. */ + @java.lang.Override public boolean hasType() { - return ((bitField0_ & 0x00000002) == 0x00000002); + return ((bitField0_ & 0x00000002) != 0); } /** * optional uint32 type = 2; + * @return The type. */ + @java.lang.Override public int getType() { return type_; } public static final int INT_VALUE_FIELD_NUMBER = 3; /** - * optional uint32 int_value = 3; + * uint32 int_value = 3; + * @return Whether the intValue field is set. */ + @java.lang.Override public boolean hasIntValue() { return valueCase_ == 3; } /** - * optional uint32 int_value = 3; + * uint32 int_value = 3; + * @return The intValue. */ + @java.lang.Override public int getIntValue() { if (valueCase_ == 3) { return (java.lang.Integer) value_; @@ -1688,14 +1552,18 @@ public int getIntValue() { public static final int LONG_VALUE_FIELD_NUMBER = 4; /** - * optional uint64 long_value = 4; + * uint64 long_value = 4; + * @return Whether the longValue field is set. */ + @java.lang.Override public boolean hasLongValue() { return valueCase_ == 4; } /** - * optional uint64 long_value = 4; + * uint64 long_value = 4; + * @return The longValue. */ + @java.lang.Override public long getLongValue() { if (valueCase_ == 4) { return (java.lang.Long) value_; @@ -1705,14 +1573,18 @@ public long getLongValue() { public static final int FLOAT_VALUE_FIELD_NUMBER = 5; /** - * optional float float_value = 5; + * float float_value = 5; + * @return Whether the floatValue field is set. */ + @java.lang.Override public boolean hasFloatValue() { return valueCase_ == 5; } /** - * optional float float_value = 5; + * float float_value = 5; + * @return The floatValue. */ + @java.lang.Override public float getFloatValue() { if (valueCase_ == 5) { return (java.lang.Float) value_; @@ -1722,14 +1594,18 @@ public float getFloatValue() { public static final int DOUBLE_VALUE_FIELD_NUMBER = 6; /** - * optional double double_value = 6; + * double double_value = 6; + * @return Whether the doubleValue field is set. */ + @java.lang.Override public boolean hasDoubleValue() { return valueCase_ == 6; } /** - * optional double double_value = 6; + * double double_value = 6; + * @return The doubleValue. */ + @java.lang.Override public double getDoubleValue() { if (valueCase_ == 6) { return (java.lang.Double) value_; @@ -1739,14 +1615,18 @@ public double getDoubleValue() { public static final int BOOLEAN_VALUE_FIELD_NUMBER = 7; /** - * optional bool boolean_value = 7; + * bool boolean_value = 7; + * @return Whether the booleanValue field is set. */ + @java.lang.Override public boolean hasBooleanValue() { return valueCase_ == 7; } /** - * optional bool boolean_value = 7; + * bool boolean_value = 7; + * @return The booleanValue. */ + @java.lang.Override public boolean getBooleanValue() { if (valueCase_ == 7) { return (java.lang.Boolean) value_; @@ -1756,13 +1636,15 @@ public boolean getBooleanValue() { public static final int STRING_VALUE_FIELD_NUMBER = 8; /** - * optional string string_value = 8; + * string string_value = 8; + * @return Whether the stringValue field is set. */ public boolean hasStringValue() { return valueCase_ == 8; } /** - * optional string string_value = 8; + * string string_value = 8; + * @return The stringValue. */ public java.lang.String getStringValue() { java.lang.Object ref = ""; @@ -1782,7 +1664,8 @@ public java.lang.String getStringValue() { } } /** - * optional string string_value = 8; + * string string_value = 8; + * @return The bytes for stringValue. */ public com.google.protobuf.ByteString getStringValueBytes() { @@ -1805,14 +1688,18 @@ public java.lang.String getStringValue() { public static final int EXTENSION_VALUE_FIELD_NUMBER = 9; /** - * optional .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * @return Whether the extensionValue field is set. */ + @java.lang.Override public boolean hasExtensionValue() { return valueCase_ == 9; } /** - * optional .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * @return The extensionValue. */ + @java.lang.Override public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension getExtensionValue() { if (valueCase_ == 9) { return (org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension) value_; @@ -1820,8 +1707,9 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.Para return org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension.getDefaultInstance(); } /** - * optional .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; */ + @java.lang.Override public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtensionOrBuilder getExtensionValueOrBuilder() { if (valueCase_ == 9) { return (org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension) value_; @@ -1830,6 +1718,7 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.Para } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -1845,12 +1734,13 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { + if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } - if (((bitField0_ & 0x00000002) == 0x00000002)) { + if (((bitField0_ & 0x00000002) != 0)) { output.writeUInt32(2, type_); } if (valueCase_ == 3) { @@ -1879,18 +1769,19 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (valueCase_ == 9) { output.writeMessage(9, (org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension) value_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { + if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } - if (((bitField0_ & 0x00000002) == 0x00000002)) { + if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(2, type_); } @@ -1926,12 +1817,11 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(9, (org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension) value_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } - private static final long serialVersionUID = 0L; @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { @@ -1942,58 +1832,53 @@ public boolean equals(final java.lang.Object obj) { } org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter other = (org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter) obj; - boolean result = true; - result = result && (hasName() == other.hasName()); + if (hasName() != other.hasName()) return false; if (hasName()) { - result = result && getName() - .equals(other.getName()); + if (!getName() + .equals(other.getName())) return false; } - result = result && (hasType() == other.hasType()); + if (hasType() != other.hasType()) return false; if (hasType()) { - result = result && (getType() - == other.getType()); + if (getType() + != other.getType()) return false; } - result = result && getValueCase().equals( - other.getValueCase()); - if (!result) return false; + if (!getValueCase().equals(other.getValueCase())) return false; switch (valueCase_) { case 3: - result = result && (getIntValue() - == other.getIntValue()); + if (getIntValue() + != other.getIntValue()) return false; break; case 4: - result = result && (getLongValue() - == other.getLongValue()); + if (getLongValue() + != other.getLongValue()) return false; break; case 5: - result = result && ( - java.lang.Float.floatToIntBits(getFloatValue()) - == java.lang.Float.floatToIntBits( - other.getFloatValue())); + if (java.lang.Float.floatToIntBits(getFloatValue()) + != java.lang.Float.floatToIntBits( + other.getFloatValue())) return false; break; case 6: - result = result && ( - java.lang.Double.doubleToLongBits(getDoubleValue()) - == java.lang.Double.doubleToLongBits( - other.getDoubleValue())); + if (java.lang.Double.doubleToLongBits(getDoubleValue()) + != java.lang.Double.doubleToLongBits( + other.getDoubleValue())) return false; break; case 7: - result = result && (getBooleanValue() - == other.getBooleanValue()); + if (getBooleanValue() + != other.getBooleanValue()) return false; break; case 8: - result = result && getStringValue() - .equals(other.getStringValue()); + if (!getStringValue() + .equals(other.getStringValue())) return false; break; case 9: - result = result && getExtensionValue() - .equals(other.getExtensionValue()); + if (!getExtensionValue() + .equals(other.getExtensionValue())) return false; break; case 0: default: } - result = result && unknownFields.equals(other.unknownFields); - return result; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; } @java.lang.Override @@ -2002,7 +1887,7 @@ public int hashCode() { return memoizedHashCode; } int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); + hash = (19 * hash) + getDescriptor().hashCode(); if (hasName()) { hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); @@ -2047,11 +1932,22 @@ public int hashCode() { case 0: default: } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } + public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -2085,11 +1981,13 @@ public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Paramet return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } + public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } + public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -2111,6 +2009,7 @@ public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Paramet .parseWithIOException(PARSER, input, extensionRegistry); } + @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); @@ -2118,6 +2017,7 @@ public static Builder newBuilder() { public static Builder newBuilder(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } + @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); @@ -2141,6 +2041,7 @@ public static final class Builder extends return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_Template_Parameter_descriptor; } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_Template_Parameter_fieldAccessorTable @@ -2150,39 +2051,40 @@ public static final class Builder extends // Construct using org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } + @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; name_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); type_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); + if (extensionValueBuilder_ != null) { + extensionValueBuilder_.clear(); + } valueCase_ = 0; value_ = null; return this; } + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_Template_Parameter_descriptor; } + @java.lang.Override public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter getDefaultInstanceForType() { return org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.getDefaultInstance(); } + @java.lang.Override public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter build() { org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter result = buildPartial(); if (!result.isInitialized()) { @@ -2191,75 +2093,71 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter buil return result; } + @java.lang.Override public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter buildPartial() { org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter result = new org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter(this); + if (bitField0_ != 0) { buildPartial0(result); } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter result) { int from_bitField0_ = bitField0_; int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; to_bitField0_ |= 0x00000001; } - result.name_ = name_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + if (((from_bitField0_ & 0x00000002) != 0)) { + result.type_ = type_; to_bitField0_ |= 0x00000002; } - result.type_ = type_; - if (valueCase_ == 3) { - result.value_ = value_; - } - if (valueCase_ == 4) { - result.value_ = value_; - } - if (valueCase_ == 5) { - result.value_ = value_; - } - if (valueCase_ == 6) { - result.value_ = value_; - } - if (valueCase_ == 7) { - result.value_ = value_; - } - if (valueCase_ == 8) { - result.value_ = value_; - } - if (valueCase_ == 9) { - if (extensionValueBuilder_ == null) { - result.value_ = value_; - } else { - result.value_ = extensionValueBuilder_.build(); - } - } - result.bitField0_ = to_bitField0_; + result.bitField0_ |= to_bitField0_; + } + + private void buildPartialOneofs(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter result) { result.valueCase_ = valueCase_; - onBuilt(); - return result; + result.value_ = this.value_; + if (valueCase_ == 9 && + extensionValueBuilder_ != null) { + result.value_ = extensionValueBuilder_.build(); + } } + @java.lang.Override public Builder clone() { - return (Builder) super.clone(); + return super.clone(); } + @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); + java.lang.Object value) { + return super.setField(field, value); } + @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); + return super.clearField(field); } + @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); + return super.clearOneof(oneof); } + @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); } + @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); + java.lang.Object value) { + return super.addRepeatedField(field, value); } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter) { return mergeFrom((org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter)other); @@ -2272,8 +2170,8 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter other) { if (other == org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.getDefaultInstance()) return this; if (other.hasName()) { - bitField0_ |= 0x00000001; name_ = other.name_; + bitField0_ |= 0x00000001; onChanged(); } if (other.hasType()) { @@ -2314,11 +2212,12 @@ public Builder mergeFrom(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Templ break; } } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { if (hasExtensionValue()) { if (!getExtensionValue().isInitialized()) { @@ -2328,21 +2227,83 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readBytes(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: { + type_ = input.readUInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + value_ = input.readUInt32(); + valueCase_ = 3; + break; + } // case 24 + case 32: { + value_ = input.readUInt64(); + valueCase_ = 4; + break; + } // case 32 + case 45: { + value_ = input.readFloat(); + valueCase_ = 5; + break; + } // case 45 + case 49: { + value_ = input.readDouble(); + valueCase_ = 6; + break; + } // case 49 + case 56: { + value_ = input.readBool(); + valueCase_ = 7; + break; + } // case 56 + case 66: { + com.google.protobuf.ByteString bs = input.readBytes(); + valueCase_ = 8; + value_ = bs; + break; + } // case 66 + case 74: { + input.readMessage( + getExtensionValueFieldBuilder().getBuilder(), + extensionRegistry); + valueCase_ = 9; + break; + } // case 74 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int valueCase_ = 0; @@ -2365,12 +2326,14 @@ public Builder clearValue() { private java.lang.Object name_ = ""; /** * optional string name = 1; + * @return Whether the name field is set. */ public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); + return ((bitField0_ & 0x00000001) != 0); } /** * optional string name = 1; + * @return The name. */ public java.lang.String getName() { java.lang.Object ref = name_; @@ -2388,6 +2351,7 @@ public java.lang.String getName() { } /** * optional string name = 1; + * @return The bytes for name. */ public com.google.protobuf.ByteString getNameBytes() { @@ -2404,36 +2368,37 @@ public java.lang.String getName() { } /** * optional string name = 1; + * @param value The name to set. + * @return This builder for chaining. */ public Builder setName( java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; + if (value == null) { throw new NullPointerException(); } name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } /** * optional string name = 1; + * @return This builder for chaining. */ public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000001); name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } /** * optional string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. */ public Builder setNameBytes( com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; + if (value == null) { throw new NullPointerException(); } name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } @@ -2441,27 +2406,35 @@ public Builder setNameBytes( private int type_ ; /** * optional uint32 type = 2; + * @return Whether the type field is set. */ + @java.lang.Override public boolean hasType() { - return ((bitField0_ & 0x00000002) == 0x00000002); + return ((bitField0_ & 0x00000002) != 0); } /** * optional uint32 type = 2; + * @return The type. */ + @java.lang.Override public int getType() { return type_; } /** * optional uint32 type = 2; + * @param value The type to set. + * @return This builder for chaining. */ public Builder setType(int value) { - bitField0_ |= 0x00000002; + type_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } /** * optional uint32 type = 2; + * @return This builder for chaining. */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000002); @@ -2471,13 +2444,15 @@ public Builder clearType() { } /** - * optional uint32 int_value = 3; + * uint32 int_value = 3; + * @return Whether the intValue field is set. */ public boolean hasIntValue() { return valueCase_ == 3; } /** - * optional uint32 int_value = 3; + * uint32 int_value = 3; + * @return The intValue. */ public int getIntValue() { if (valueCase_ == 3) { @@ -2486,16 +2461,20 @@ public int getIntValue() { return 0; } /** - * optional uint32 int_value = 3; + * uint32 int_value = 3; + * @param value The intValue to set. + * @return This builder for chaining. */ public Builder setIntValue(int value) { + valueCase_ = 3; value_ = value; onChanged(); return this; } /** - * optional uint32 int_value = 3; + * uint32 int_value = 3; + * @return This builder for chaining. */ public Builder clearIntValue() { if (valueCase_ == 3) { @@ -2507,13 +2486,15 @@ public Builder clearIntValue() { } /** - * optional uint64 long_value = 4; + * uint64 long_value = 4; + * @return Whether the longValue field is set. */ public boolean hasLongValue() { return valueCase_ == 4; } /** - * optional uint64 long_value = 4; + * uint64 long_value = 4; + * @return The longValue. */ public long getLongValue() { if (valueCase_ == 4) { @@ -2522,16 +2503,20 @@ public long getLongValue() { return 0L; } /** - * optional uint64 long_value = 4; + * uint64 long_value = 4; + * @param value The longValue to set. + * @return This builder for chaining. */ public Builder setLongValue(long value) { + valueCase_ = 4; value_ = value; onChanged(); return this; } /** - * optional uint64 long_value = 4; + * uint64 long_value = 4; + * @return This builder for chaining. */ public Builder clearLongValue() { if (valueCase_ == 4) { @@ -2543,13 +2528,15 @@ public Builder clearLongValue() { } /** - * optional float float_value = 5; + * float float_value = 5; + * @return Whether the floatValue field is set. */ public boolean hasFloatValue() { return valueCase_ == 5; } /** - * optional float float_value = 5; + * float float_value = 5; + * @return The floatValue. */ public float getFloatValue() { if (valueCase_ == 5) { @@ -2558,16 +2545,20 @@ public float getFloatValue() { return 0F; } /** - * optional float float_value = 5; + * float float_value = 5; + * @param value The floatValue to set. + * @return This builder for chaining. */ public Builder setFloatValue(float value) { + valueCase_ = 5; value_ = value; onChanged(); return this; } /** - * optional float float_value = 5; + * float float_value = 5; + * @return This builder for chaining. */ public Builder clearFloatValue() { if (valueCase_ == 5) { @@ -2579,13 +2570,15 @@ public Builder clearFloatValue() { } /** - * optional double double_value = 6; + * double double_value = 6; + * @return Whether the doubleValue field is set. */ public boolean hasDoubleValue() { return valueCase_ == 6; } /** - * optional double double_value = 6; + * double double_value = 6; + * @return The doubleValue. */ public double getDoubleValue() { if (valueCase_ == 6) { @@ -2594,16 +2587,20 @@ public double getDoubleValue() { return 0D; } /** - * optional double double_value = 6; + * double double_value = 6; + * @param value The doubleValue to set. + * @return This builder for chaining. */ public Builder setDoubleValue(double value) { + valueCase_ = 6; value_ = value; onChanged(); return this; } /** - * optional double double_value = 6; + * double double_value = 6; + * @return This builder for chaining. */ public Builder clearDoubleValue() { if (valueCase_ == 6) { @@ -2615,13 +2612,15 @@ public Builder clearDoubleValue() { } /** - * optional bool boolean_value = 7; + * bool boolean_value = 7; + * @return Whether the booleanValue field is set. */ public boolean hasBooleanValue() { return valueCase_ == 7; } /** - * optional bool boolean_value = 7; + * bool boolean_value = 7; + * @return The booleanValue. */ public boolean getBooleanValue() { if (valueCase_ == 7) { @@ -2630,16 +2629,20 @@ public boolean getBooleanValue() { return false; } /** - * optional bool boolean_value = 7; + * bool boolean_value = 7; + * @param value The booleanValue to set. + * @return This builder for chaining. */ public Builder setBooleanValue(boolean value) { + valueCase_ = 7; value_ = value; onChanged(); return this; } /** - * optional bool boolean_value = 7; + * bool boolean_value = 7; + * @return This builder for chaining. */ public Builder clearBooleanValue() { if (valueCase_ == 7) { @@ -2651,14 +2654,18 @@ public Builder clearBooleanValue() { } /** - * optional string string_value = 8; + * string string_value = 8; + * @return Whether the stringValue field is set. */ + @java.lang.Override public boolean hasStringValue() { return valueCase_ == 8; } /** - * optional string string_value = 8; + * string string_value = 8; + * @return The stringValue. */ + @java.lang.Override public java.lang.String getStringValue() { java.lang.Object ref = ""; if (valueCase_ == 8) { @@ -2679,8 +2686,10 @@ public java.lang.String getStringValue() { } } /** - * optional string string_value = 8; + * string string_value = 8; + * @return The bytes for stringValue. */ + @java.lang.Override public com.google.protobuf.ByteString getStringValueBytes() { java.lang.Object ref = ""; @@ -2700,20 +2709,21 @@ public java.lang.String getStringValue() { } } /** - * optional string string_value = 8; + * string string_value = 8; + * @param value The stringValue to set. + * @return This builder for chaining. */ public Builder setStringValue( java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - valueCase_ = 8; + if (value == null) { throw new NullPointerException(); } + valueCase_ = 8; value_ = value; onChanged(); return this; } /** - * optional string string_value = 8; + * string string_value = 8; + * @return This builder for chaining. */ public Builder clearStringValue() { if (valueCase_ == 8) { @@ -2724,14 +2734,14 @@ public Builder clearStringValue() { return this; } /** - * optional string string_value = 8; + * string string_value = 8; + * @param value The bytes for stringValue to set. + * @return This builder for chaining. */ public Builder setStringValueBytes( com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - valueCase_ = 8; + if (value == null) { throw new NullPointerException(); } + valueCase_ = 8; value_ = value; onChanged(); return this; @@ -2740,14 +2750,18 @@ public Builder setStringValueBytes( private com.google.protobuf.SingleFieldBuilderV3< org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension, org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension.Builder, org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtensionOrBuilder> extensionValueBuilder_; /** - * optional .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * @return Whether the extensionValue field is set. */ + @java.lang.Override public boolean hasExtensionValue() { return valueCase_ == 9; } /** - * optional .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * @return The extensionValue. */ + @java.lang.Override public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension getExtensionValue() { if (extensionValueBuilder_ == null) { if (valueCase_ == 9) { @@ -2762,7 +2776,7 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.Para } } /** - * optional .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; */ public Builder setExtensionValue(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension value) { if (extensionValueBuilder_ == null) { @@ -2778,7 +2792,7 @@ public Builder setExtensionValue(org.eclipse.tahu.protobuf.SparkplugBProto.Paylo return this; } /** - * optional .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; */ public Builder setExtensionValue( org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension.Builder builderForValue) { @@ -2792,7 +2806,7 @@ public Builder setExtensionValue( return this; } /** - * optional .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; */ public Builder mergeExtensionValue(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension value) { if (extensionValueBuilder_ == null) { @@ -2807,14 +2821,15 @@ public Builder mergeExtensionValue(org.eclipse.tahu.protobuf.SparkplugBProto.Pay } else { if (valueCase_ == 9) { extensionValueBuilder_.mergeFrom(value); + } else { + extensionValueBuilder_.setMessage(value); } - extensionValueBuilder_.setMessage(value); } valueCase_ = 9; return this; } /** - * optional .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; */ public Builder clearExtensionValue() { if (extensionValueBuilder_ == null) { @@ -2833,14 +2848,15 @@ public Builder clearExtensionValue() { return this; } /** - * optional .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; */ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension.Builder getExtensionValueBuilder() { return getExtensionValueFieldBuilder().getBuilder(); } /** - * optional .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; */ + @java.lang.Override public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtensionOrBuilder getExtensionValueOrBuilder() { if ((valueCase_ == 9) && (extensionValueBuilder_ != null)) { return extensionValueBuilder_.getMessageOrBuilder(); @@ -2852,7 +2868,7 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.Para } } /** - * optional .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; + * .org.eclipse.tahu.protobuf.Payload.Template.Parameter.ParameterValueExtension extension_value = 9; */ private com.google.protobuf.SingleFieldBuilderV3< org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension, org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtension.Builder, org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.ParameterValueExtensionOrBuilder> @@ -2869,14 +2885,16 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.Para value_ = null; } valueCase_ = 9; - onChanged();; + onChanged(); return extensionValueBuilder_; } + @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } + @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); @@ -2898,11 +2916,23 @@ public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Paramet @java.lang.Deprecated public static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override public Parameter parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new Parameter(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -2915,6 +2945,7 @@ public com.google.protobuf.Parser getParserForType() { return PARSER; } + @java.lang.Override public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter getDefaultInstanceForType() { return DEFAULT_INSTANCE; } @@ -2923,16 +2954,19 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter getD private int bitField0_; public static final int VERSION_FIELD_NUMBER = 1; - private volatile java.lang.Object version_; + @SuppressWarnings("serial") + private volatile java.lang.Object version_ = ""; /** *
        * The version of the Template to prevent mismatches
        * 
* * optional string version = 1; + * @return Whether the version field is set. */ + @java.lang.Override public boolean hasVersion() { - return ((bitField0_ & 0x00000001) == 0x00000001); + return ((bitField0_ & 0x00000001) != 0); } /** *
@@ -2940,7 +2974,9 @@ public boolean hasVersion() {
        * 
* * optional string version = 1; + * @return The version. */ + @java.lang.Override public java.lang.String getVersion() { java.lang.Object ref = version_; if (ref instanceof java.lang.String) { @@ -2961,7 +2997,9 @@ public java.lang.String getVersion() { * * * optional string version = 1; + * @return The bytes for version. */ + @java.lang.Override public com.google.protobuf.ByteString getVersionBytes() { java.lang.Object ref = version_; @@ -2977,6 +3015,7 @@ public java.lang.String getVersion() { } public static final int METRICS_FIELD_NUMBER = 2; + @SuppressWarnings("serial") private java.util.List metrics_; /** *
@@ -2985,6 +3024,7 @@ public java.lang.String getVersion() {
        *
        * repeated .org.eclipse.tahu.protobuf.Payload.Metric metrics = 2;
        */
+      @java.lang.Override
       public java.util.List getMetricsList() {
         return metrics_;
       }
@@ -2995,6 +3035,7 @@ public java.util.List
        *
        * repeated .org.eclipse.tahu.protobuf.Payload.Metric metrics = 2;
        */
+      @java.lang.Override
       public java.util.List 
           getMetricsOrBuilderList() {
         return metrics_;
@@ -3006,6 +3047,7 @@ public java.util.List
        *
        * repeated .org.eclipse.tahu.protobuf.Payload.Metric metrics = 2;
        */
+      @java.lang.Override
       public int getMetricsCount() {
         return metrics_.size();
       }
@@ -3016,6 +3058,7 @@ public int getMetricsCount() {
        *
        * repeated .org.eclipse.tahu.protobuf.Payload.Metric metrics = 2;
        */
+      @java.lang.Override
       public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Metric getMetrics(int index) {
         return metrics_.get(index);
       }
@@ -3026,22 +3069,26 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Metric getMetrics(int i
        *
        * repeated .org.eclipse.tahu.protobuf.Payload.Metric metrics = 2;
        */
+      @java.lang.Override
       public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.MetricOrBuilder getMetricsOrBuilder(
           int index) {
         return metrics_.get(index);
       }
 
       public static final int PARAMETERS_FIELD_NUMBER = 3;
+      @SuppressWarnings("serial")
       private java.util.List parameters_;
       /**
        * repeated .org.eclipse.tahu.protobuf.Payload.Template.Parameter parameters = 3;
        */
+      @java.lang.Override
       public java.util.List getParametersList() {
         return parameters_;
       }
       /**
        * repeated .org.eclipse.tahu.protobuf.Payload.Template.Parameter parameters = 3;
        */
+      @java.lang.Override
       public java.util.List 
           getParametersOrBuilderList() {
         return parameters_;
@@ -3049,42 +3096,50 @@ public java.util.Listrepeated .org.eclipse.tahu.protobuf.Payload.Template.Parameter parameters = 3;
        */
+      @java.lang.Override
       public int getParametersCount() {
         return parameters_.size();
       }
       /**
        * repeated .org.eclipse.tahu.protobuf.Payload.Template.Parameter parameters = 3;
        */
+      @java.lang.Override
       public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter getParameters(int index) {
         return parameters_.get(index);
       }
       /**
        * repeated .org.eclipse.tahu.protobuf.Payload.Template.Parameter parameters = 3;
        */
+      @java.lang.Override
       public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.ParameterOrBuilder getParametersOrBuilder(
           int index) {
         return parameters_.get(index);
       }
 
       public static final int TEMPLATE_REF_FIELD_NUMBER = 4;
-      private volatile java.lang.Object templateRef_;
+      @SuppressWarnings("serial")
+      private volatile java.lang.Object templateRef_ = "";
       /**
        * 
-       * Reference to a template if this is extending a Template or an instance - must exist if an instance
+       * MUST be a reference to a template definition if this is an instance (i.e. the name of the template definition) - MUST be omitted for template definitions
        * 
* * optional string template_ref = 4; + * @return Whether the templateRef field is set. */ + @java.lang.Override public boolean hasTemplateRef() { - return ((bitField0_ & 0x00000002) == 0x00000002); + return ((bitField0_ & 0x00000002) != 0); } /** *
-       * Reference to a template if this is extending a Template or an instance - must exist if an instance
+       * MUST be a reference to a template definition if this is an instance (i.e. the name of the template definition) - MUST be omitted for template definitions
        * 
* * optional string template_ref = 4; + * @return The templateRef. */ + @java.lang.Override public java.lang.String getTemplateRef() { java.lang.Object ref = templateRef_; if (ref instanceof java.lang.String) { @@ -3101,11 +3156,13 @@ public java.lang.String getTemplateRef() { } /** *
-       * Reference to a template if this is extending a Template or an instance - must exist if an instance
+       * MUST be a reference to a template definition if this is an instance (i.e. the name of the template definition) - MUST be omitted for template definitions
        * 
* * optional string template_ref = 4; + * @return The bytes for templateRef. */ + @java.lang.Override public com.google.protobuf.ByteString getTemplateRefBytes() { java.lang.Object ref = templateRef_; @@ -3121,21 +3178,26 @@ public java.lang.String getTemplateRef() { } public static final int IS_DEFINITION_FIELD_NUMBER = 5; - private boolean isDefinition_; + private boolean isDefinition_ = false; /** * optional bool is_definition = 5; + * @return Whether the isDefinition field is set. */ + @java.lang.Override public boolean hasIsDefinition() { - return ((bitField0_ & 0x00000004) == 0x00000004); + return ((bitField0_ & 0x00000004) != 0); } /** * optional bool is_definition = 5; + * @return The isDefinition. */ + @java.lang.Override public boolean getIsDefinition() { return isDefinition_; } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -3161,12 +3223,13 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { com.google.protobuf.GeneratedMessageV3 .ExtendableMessage.ExtensionWriter extensionWriter = newExtensionWriter(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { + if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, version_); } for (int i = 0; i < metrics_.size(); i++) { @@ -3175,22 +3238,23 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) for (int i = 0; i < parameters_.size(); i++) { output.writeMessage(3, parameters_.get(i)); } - if (((bitField0_ & 0x00000002) == 0x00000002)) { + if (((bitField0_ & 0x00000002) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 4, templateRef_); } - if (((bitField0_ & 0x00000004) == 0x00000004)) { + if (((bitField0_ & 0x00000004) != 0)) { output.writeBool(5, isDefinition_); } extensionWriter.writeUntil(536870912, output); - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { + if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, version_); } for (int i = 0; i < metrics_.size(); i++) { @@ -3201,20 +3265,19 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(3, parameters_.get(i)); } - if (((bitField0_ & 0x00000002) == 0x00000002)) { + if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, templateRef_); } - if (((bitField0_ & 0x00000004) == 0x00000004)) { + if (((bitField0_ & 0x00000004) != 0)) { size += com.google.protobuf.CodedOutputStream .computeBoolSize(5, isDefinition_); } size += extensionsSerializedSize(); - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } - private static final long serialVersionUID = 0L; @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { @@ -3225,30 +3288,29 @@ public boolean equals(final java.lang.Object obj) { } org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template other = (org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template) obj; - boolean result = true; - result = result && (hasVersion() == other.hasVersion()); + if (hasVersion() != other.hasVersion()) return false; if (hasVersion()) { - result = result && getVersion() - .equals(other.getVersion()); - } - result = result && getMetricsList() - .equals(other.getMetricsList()); - result = result && getParametersList() - .equals(other.getParametersList()); - result = result && (hasTemplateRef() == other.hasTemplateRef()); + if (!getVersion() + .equals(other.getVersion())) return false; + } + if (!getMetricsList() + .equals(other.getMetricsList())) return false; + if (!getParametersList() + .equals(other.getParametersList())) return false; + if (hasTemplateRef() != other.hasTemplateRef()) return false; if (hasTemplateRef()) { - result = result && getTemplateRef() - .equals(other.getTemplateRef()); + if (!getTemplateRef() + .equals(other.getTemplateRef())) return false; } - result = result && (hasIsDefinition() == other.hasIsDefinition()); + if (hasIsDefinition() != other.hasIsDefinition()) return false; if (hasIsDefinition()) { - result = result && (getIsDefinition() - == other.getIsDefinition()); + if (getIsDefinition() + != other.getIsDefinition()) return false; } - result = result && unknownFields.equals(other.unknownFields); - result = result && - getExtensionFields().equals(other.getExtensionFields()); - return result; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!getExtensionFields().equals(other.getExtensionFields())) + return false; + return true; } @java.lang.Override @@ -3257,7 +3319,7 @@ public int hashCode() { return memoizedHashCode; } int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); + hash = (19 * hash) + getDescriptor().hashCode(); if (hasVersion()) { hash = (37 * hash) + VERSION_FIELD_NUMBER; hash = (53 * hash) + getVersion().hashCode(); @@ -3280,11 +3342,22 @@ public int hashCode() { getIsDefinition()); } hash = hashFields(hash, getExtensionFields()); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } + public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -3318,11 +3391,13 @@ public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template parseFr return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } + public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } + public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -3344,6 +3419,7 @@ public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template parseFr .parseWithIOException(PARSER, input, extensionRegistry); } + @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); @@ -3351,6 +3427,7 @@ public static Builder newBuilder() { public static Builder newBuilder(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } + @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); @@ -3375,6 +3452,7 @@ public static final class Builder extends return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_Template_descriptor; } + @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_Template_fieldAccessorTable @@ -3384,53 +3462,50 @@ public static final class Builder extends // Construct using org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getMetricsFieldBuilder(); - getParametersFieldBuilder(); - } + } + @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; version_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); if (metricsBuilder_ == null) { metrics_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); } else { + metrics_ = null; metricsBuilder_.clear(); } + bitField0_ = (bitField0_ & ~0x00000002); if (parametersBuilder_ == null) { parameters_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); } else { + parameters_ = null; parametersBuilder_.clear(); } + bitField0_ = (bitField0_ & ~0x00000004); templateRef_ = ""; - bitField0_ = (bitField0_ & ~0x00000008); isDefinition_ = false; - bitField0_ = (bitField0_ & ~0x00000010); return this; } + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.eclipse.tahu.protobuf.SparkplugBProto.internal_static_org_eclipse_tahu_protobuf_Payload_Template_descriptor; } + @java.lang.Override public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template getDefaultInstanceForType() { return org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.getDefaultInstance(); } + @java.lang.Override public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template build() { org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template result = buildPartial(); if (!result.isInitialized()) { @@ -3439,16 +3514,18 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template build() { return result; } + @java.lang.Override public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template buildPartial() { org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template result = new org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.version_ = version_; + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template result) { if (metricsBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { + if (((bitField0_ & 0x00000002) != 0)) { metrics_ = java.util.Collections.unmodifiableList(metrics_); bitField0_ = (bitField0_ & ~0x00000002); } @@ -3457,7 +3534,7 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template buildPartial() result.metrics_ = metricsBuilder_.build(); } if (parametersBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004)) { + if (((bitField0_ & 0x00000004) != 0)) { parameters_ = java.util.Collections.unmodifiableList(parameters_); bitField0_ = (bitField0_ & ~0x00000004); } @@ -3465,68 +3542,86 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template buildPartial() } else { result.parameters_ = parametersBuilder_.build(); } - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + } + + private void buildPartial0(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.version_ = version_; + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.templateRef_ = templateRef_; to_bitField0_ |= 0x00000002; } - result.templateRef_ = templateRef_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + if (((from_bitField0_ & 0x00000010) != 0)) { + result.isDefinition_ = isDefinition_; to_bitField0_ |= 0x00000004; } - result.isDefinition_ = isDefinition_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; + result.bitField0_ |= to_bitField0_; } + @java.lang.Override public Builder clone() { - return (Builder) super.clone(); + return super.clone(); } + @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); + java.lang.Object value) { + return super.setField(field, value); } + @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); + return super.clearField(field); } + @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); + return super.clearOneof(oneof); } + @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); } + @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); + java.lang.Object value) { + return super.addRepeatedField(field, value); } + @java.lang.Override public Builder setExtension( com.google.protobuf.GeneratedMessage.GeneratedExtension< org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template, Type> extension, Type value) { - return (Builder) super.setExtension(extension, value); + return super.setExtension(extension, value); } + @java.lang.Override public Builder setExtension( com.google.protobuf.GeneratedMessage.GeneratedExtension< org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template, java.util.List> extension, int index, Type value) { - return (Builder) super.setExtension(extension, index, value); + return super.setExtension(extension, index, value); } + @java.lang.Override public Builder addExtension( com.google.protobuf.GeneratedMessage.GeneratedExtension< org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template, java.util.List> extension, Type value) { - return (Builder) super.addExtension(extension, value); + return super.addExtension(extension, value); } - public Builder clearExtension( + @java.lang.Override + public Builder clearExtension( com.google.protobuf.GeneratedMessage.GeneratedExtension< - org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template, ?> extension) { - return (Builder) super.clearExtension(extension); + org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template, T> extension) { + return super.clearExtension(extension); } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template) { return mergeFrom((org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template)other); @@ -3539,8 +3634,8 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template other) { if (other == org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.getDefaultInstance()) return this; if (other.hasVersion()) { - bitField0_ |= 0x00000001; version_ = other.version_; + bitField0_ |= 0x00000001; onChanged(); } if (metricsBuilder_ == null) { @@ -3596,19 +3691,20 @@ public Builder mergeFrom(org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Templ } } if (other.hasTemplateRef()) { - bitField0_ |= 0x00000008; templateRef_ = other.templateRef_; + bitField0_ |= 0x00000008; onChanged(); } if (other.hasIsDefinition()) { setIsDefinition(other.getIsDefinition()); } this.mergeExtensionFields(other); - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { for (int i = 0; i < getMetricsCount(); i++) { if (!getMetrics(i).isInitialized()) { @@ -3626,21 +3722,76 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + version_ = input.readBytes(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Metric m = + input.readMessage( + org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Metric.PARSER, + extensionRegistry); + if (metricsBuilder_ == null) { + ensureMetricsIsMutable(); + metrics_.add(m); + } else { + metricsBuilder_.addMessage(m); + } + break; + } // case 18 + case 26: { + org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter m = + input.readMessage( + org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.PARSER, + extensionRegistry); + if (parametersBuilder_ == null) { + ensureParametersIsMutable(); + parameters_.add(m); + } else { + parametersBuilder_.addMessage(m); + } + break; + } // case 26 + case 34: { + templateRef_ = input.readBytes(); + bitField0_ |= 0x00000008; + break; + } // case 34 + case 40: { + isDefinition_ = input.readBool(); + bitField0_ |= 0x00000010; + break; + } // case 40 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -3652,9 +3803,10 @@ public Builder mergeFrom( *
* * optional string version = 1; + * @return Whether the version field is set. */ public boolean hasVersion() { - return ((bitField0_ & 0x00000001) == 0x00000001); + return ((bitField0_ & 0x00000001) != 0); } /** *
@@ -3662,6 +3814,7 @@ public boolean hasVersion() {
          * 
* * optional string version = 1; + * @return The version. */ public java.lang.String getVersion() { java.lang.Object ref = version_; @@ -3683,6 +3836,7 @@ public java.lang.String getVersion() { * * * optional string version = 1; + * @return The bytes for version. */ public com.google.protobuf.ByteString getVersionBytes() { @@ -3703,14 +3857,14 @@ public java.lang.String getVersion() { * * * optional string version = 1; + * @param value The version to set. + * @return This builder for chaining. */ public Builder setVersion( java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; + if (value == null) { throw new NullPointerException(); } version_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } @@ -3720,10 +3874,11 @@ public Builder setVersion( * * * optional string version = 1; + * @return This builder for chaining. */ public Builder clearVersion() { - bitField0_ = (bitField0_ & ~0x00000001); version_ = getDefaultInstance().getVersion(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } @@ -3733,14 +3888,14 @@ public Builder clearVersion() { * * * optional string version = 1; + * @param value The bytes for version to set. + * @return This builder for chaining. */ public Builder setVersionBytes( com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; + if (value == null) { throw new NullPointerException(); } version_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } @@ -3748,7 +3903,7 @@ public Builder setVersionBytes( private java.util.List metrics_ = java.util.Collections.emptyList(); private void ensureMetricsIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { + if (!((bitField0_ & 0x00000002) != 0)) { metrics_ = new java.util.ArrayList(metrics_); bitField0_ |= 0x00000002; } @@ -4049,7 +4204,7 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Metric.Builder addMetri metricsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Metric, org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Metric.Builder, org.eclipse.tahu.protobuf.SparkplugBProto.Payload.MetricOrBuilder>( metrics_, - ((bitField0_ & 0x00000002) == 0x00000002), + ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); metrics_ = null; @@ -4060,7 +4215,7 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Metric.Builder addMetri private java.util.List parameters_ = java.util.Collections.emptyList(); private void ensureParametersIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { + if (!((bitField0_ & 0x00000004) != 0)) { parameters_ = new java.util.ArrayList(parameters_); bitField0_ |= 0x00000004; } @@ -4289,7 +4444,7 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.Buil parametersBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter, org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.Builder, org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.ParameterOrBuilder>( parameters_, - ((bitField0_ & 0x00000004) == 0x00000004), + ((bitField0_ & 0x00000004) != 0), getParentForChildren(), isClean()); parameters_ = null; @@ -4300,20 +4455,22 @@ public org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template.Parameter.Buil private java.lang.Object templateRef_ = ""; /** *
-         * Reference to a template if this is extending a Template or an instance - must exist if an instance
+         * MUST be a reference to a template definition if this is an instance (i.e. the name of the template definition) - MUST be omitted for template definitions
          * 
* * optional string template_ref = 4; + * @return Whether the templateRef field is set. */ public boolean hasTemplateRef() { - return ((bitField0_ & 0x00000008) == 0x00000008); + return ((bitField0_ & 0x00000008) != 0); } /** *
-         * Reference to a template if this is extending a Template or an instance - must exist if an instance
+         * MUST be a reference to a template definition if this is an instance (i.e. the name of the template definition) - MUST be omitted for template definitions
          * 
* * optional string template_ref = 4; + * @return The templateRef. */ public java.lang.String getTemplateRef() { java.lang.Object ref = templateRef_; @@ -4331,10 +4488,11 @@ public java.lang.String getTemplateRef() { } /** *
-         * Reference to a template if this is extending a Template or an instance - must exist if an instance
+         * MUST be a reference to a template definition if this is an instance (i.e. the name of the template definition) - MUST be omitted for template definitions
          * 
* * optional string template_ref = 4; + * @return The bytes for templateRef. */ public com.google.protobuf.ByteString getTemplateRefBytes() { @@ -4351,48 +4509,49 @@ public java.lang.String getTemplateRef() { } /** *
-         * Reference to a template if this is extending a Template or an instance - must exist if an instance
+         * MUST be a reference to a template definition if this is an instance (i.e. the name of the template definition) - MUST be omitted for template definitions
          * 
* * optional string template_ref = 4; + * @param value The templateRef to set. + * @return This builder for chaining. */ public Builder setTemplateRef( java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; + if (value == null) { throw new NullPointerException(); } templateRef_ = value; + bitField0_ |= 0x00000008; onChanged(); return this; } /** *
-         * Reference to a template if this is extending a Template or an instance - must exist if an instance
+         * MUST be a reference to a template definition if this is an instance (i.e. the name of the template definition) - MUST be omitted for template definitions
          * 
* * optional string template_ref = 4; + * @return This builder for chaining. */ public Builder clearTemplateRef() { - bitField0_ = (bitField0_ & ~0x00000008); templateRef_ = getDefaultInstance().getTemplateRef(); + bitField0_ = (bitField0_ & ~0x00000008); onChanged(); return this; } /** *
-         * Reference to a template if this is extending a Template or an instance - must exist if an instance
+         * MUST be a reference to a template definition if this is an instance (i.e. the name of the template definition) - MUST be omitted for template definitions
          * 
* * optional string template_ref = 4; + * @param value The bytes for templateRef to set. + * @return This builder for chaining. */ public Builder setTemplateRefBytes( com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; + if (value == null) { throw new NullPointerException(); } templateRef_ = value; + bitField0_ |= 0x00000008; onChanged(); return this; } @@ -4400,27 +4559,35 @@ public Builder setTemplateRefBytes( private boolean isDefinition_ ; /** * optional bool is_definition = 5; + * @return Whether the isDefinition field is set. */ + @java.lang.Override public boolean hasIsDefinition() { - return ((bitField0_ & 0x00000010) == 0x00000010); + return ((bitField0_ & 0x00000010) != 0); } /** * optional bool is_definition = 5; + * @return The isDefinition. */ + @java.lang.Override public boolean getIsDefinition() { return isDefinition_; } /** * optional bool is_definition = 5; + * @param value The isDefinition to set. + * @return This builder for chaining. */ public Builder setIsDefinition(boolean value) { - bitField0_ |= 0x00000010; + isDefinition_ = value; + bitField0_ |= 0x00000010; onChanged(); return this; } /** * optional bool is_definition = 5; + * @return This builder for chaining. */ public Builder clearIsDefinition() { bitField0_ = (bitField0_ & ~0x00000010); @@ -4428,11 +4595,13 @@ public Builder clearIsDefinition() { onChanged(); return this; } + @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } + @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); @@ -4454,11 +4623,23 @@ public static org.eclipse.tahu.protobuf.SparkplugBProto.Payload.Template getDefa @java.lang.Deprecated public static final com.google.protobuf.Parser