You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2018/02/16 22:31:08 UTC
[incubator-plc4x] branch master updated: fixed a bunch of sonar
warnings.
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
The following commit(s) were added to refs/heads/master by this push:
new 976d15f fixed a bunch of sonar warnings.
976d15f is described below
commit 976d15f371d673d873ea85436fc7cd65a368f7de
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri Feb 16 23:31:02 2018 +0100
fixed a bunch of sonar warnings.
---
.../java/ads/api/commands/ADSAbstractRequest.java | 10 ++---
.../java/ads/api/commands/ADSAbstractResponse.java | 6 +--
.../commands/ADSAddDeviceNotificationRequest.java | 44 +++++++++++-----------
.../commands/ADSAddDeviceNotificationResponse.java | 14 +++----
.../ADSDeleteDeviceNotificationRequest.java | 14 +++----
.../ADSDeleteDeviceNotificationResponse.java | 10 ++---
.../api/commands/ADSDeviceNotificationRequest.java | 25 ++++++------
.../ads/api/commands/ADSReadDeviceInfoRequest.java | 6 +--
.../api/commands/ADSReadDeviceInfoResponse.java | 26 ++++++-------
.../java/ads/api/commands/ADSReadRequest.java | 26 ++++++-------
.../java/ads/api/commands/ADSReadResponse.java | 20 +++++-----
.../java/ads/api/commands/ADSReadStateRequest.java | 6 +--
.../ads/api/commands/ADSReadStateResponse.java | 10 ++---
.../java/ads/api/commands/ADSReadWriteRequest.java | 38 +++++++++----------
.../ads/api/commands/ADSReadWriteResponse.java | 18 ++++-----
.../ads/api/commands/ADSWriteControlRequest.java | 30 +++++++--------
.../ads/api/commands/ADSWriteControlResponse.java | 10 ++---
.../java/ads/api/commands/ADSWriteRequest.java | 32 ++++++++--------
.../java/ads/api/commands/ADSWriteResponse.java | 10 ++---
.../java/ads/api/commands/UnknownCommand.java | 8 ++--
.../java/ads/api/commands/types/ADSState.java | 8 ++--
.../api/commands/types/AdsNotificationSample.java | 19 +++++-----
.../java/ads/api/commands/types/AdsReturnCode.java | 15 ++++----
.../ads/api/commands/types/AdsStampHeader.java | 16 ++++----
.../java/ads/api/commands/types/CycleTime.java | 8 ++--
.../plc4x/java/ads/api/commands/types/Data.java | 10 +++--
.../plc4x/java/ads/api/commands/types/Device.java | 11 +++---
.../java/ads/api/commands/types/DeviceState.java | 8 ++--
.../java/ads/api/commands/types/IndexGroup.java | 8 ++--
.../java/ads/api/commands/types/IndexOffset.java | 8 ++--
.../plc4x/java/ads/api/commands/types/Length.java | 8 ++--
.../java/ads/api/commands/types/MajorVersion.java | 6 +--
.../java/ads/api/commands/types/MaxDelay.java | 8 ++--
.../java/ads/api/commands/types/MinorVersion.java | 6 +--
.../ads/api/commands/types/NotificationHandle.java | 8 ++--
.../java/ads/api/commands/types/ReadLength.java | 8 ++--
.../plc4x/java/ads/api/commands/types/Result.java | 8 ++--
.../java/ads/api/commands/types/SampleSize.java | 8 ++--
.../plc4x/java/ads/api/commands/types/Samples.java | 8 ++--
.../plc4x/java/ads/api/commands/types/Stamps.java | 8 ++--
.../java/ads/api/commands/types/TimeStamp.java | 25 ++++++------
.../ads/api/commands/types/TransmissionMode.java | 8 ++--
.../plc4x/java/ads/api/commands/types/Version.java | 10 ++---
.../java/ads/api/commands/types/WriteLength.java | 8 ++--
.../plc4x/java/ads/api/generic/AMSHeader.java | 22 +++++------
.../plc4x/java/ads/api/generic/AMSTCPHeader.java | 8 ++--
.../plc4x/java/ads/api/generic/AMSTCPPacket.java | 24 ++++++------
.../plc4x/java/ads/api/generic/types/AMSError.java | 12 +++---
.../plc4x/java/ads/api/generic/types/AMSNetId.java | 6 +--
.../plc4x/java/ads/api/generic/types/AMSPort.java | 6 +--
.../plc4x/java/ads/api/generic/types/Command.java | 4 +-
.../java/ads/api/generic/types/DataLength.java | 8 ++--
.../plc4x/java/ads/api/generic/types/Invoke.java | 8 ++--
.../plc4x/java/ads/api/generic/types/Length.java | 8 ++--
.../plc4x/java/ads/api/generic/types/State.java | 38 +++++++++----------
.../apache/plc4x/java/ads/api/util/ByteValue.java | 6 +--
.../java/ads/api/util/UnsignedIntLEByteValue.java | 12 +++---
.../ads/api/util/UnsignedShortLEByteValue.java | 14 +++----
.../java/ads/connection/ADSPlcConnection.java | 4 +-
.../apache/plc4x/java/ads/model/ADSAddress.java | 2 +-
.../apache/plc4x/java/ads/netty/ADSProtocol.java | 2 +-
.../plc4x/java/ads/netty/Plc4XADSProtocol.java | 6 +--
.../java/org/apache/plc4x/java/ads/ADSDumper.java | 2 +-
.../java/ads/api/commands/types/LengthTest.java | 4 +-
.../ads/api/commands/types/ReadLengthTest.java | 4 +-
.../ads/api/commands/types/SampleSizeTest.java | 4 +-
.../java/ads/api/commands/types/SamplesTest.java | 4 +-
.../ads/api/commands/types/WriteLengthTest.java | 4 +-
.../java/ads/api/generic/types/AMSPortTest.java | 4 +-
.../java/ads/api/generic/types/DataLengthTest.java | 4 +-
.../java/ads/api/generic/types/LengthTest.java | 4 +-
.../plc4x/java/ads/netty/Plc4XADSProtocolTest.java | 2 +-
.../apache/plc4x/java/ads/util/TcpHexDumper.java | 10 ++---
73 files changed, 420 insertions(+), 417 deletions(-)
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAbstractRequest.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAbstractRequest.java
index a9572c4..fe51679 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAbstractRequest.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAbstractRequest.java
@@ -26,20 +26,20 @@ import org.apache.plc4x.java.ads.api.generic.types.AMSPort;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
import org.apache.plc4x.java.ads.api.generic.types.State;
-public abstract class ADSAbstractRequest extends AMSTCPPacket {
- protected ADSAbstractRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader) {
+abstract class ADSAbstractRequest extends AMSTCPPacket {
+ ADSAbstractRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader) {
super(amstcpHeader, amsHeader);
}
- protected ADSAbstractRequest(AMSHeader amsHeader) {
+ ADSAbstractRequest(AMSHeader amsHeader) {
super(amsHeader);
}
- protected ADSAbstractRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId) {
+ ADSAbstractRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, State.DEFAULT, invokeId);
}
- protected ADSAbstractRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, State stateId, Invoke invokeId) {
+ ADSAbstractRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, State stateId, Invoke invokeId) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, stateId, invokeId);
}
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAbstractResponse.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAbstractResponse.java
index 8bd00d3..f55e173 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAbstractResponse.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAbstractResponse.java
@@ -26,8 +26,8 @@ import org.apache.plc4x.java.ads.api.generic.types.AMSPort;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
import org.apache.plc4x.java.ads.api.generic.types.State;
-public abstract class ADSAbstractResponse extends AMSTCPPacket {
- protected ADSAbstractResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader) {
+abstract class ADSAbstractResponse extends AMSTCPPacket {
+ ADSAbstractResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader) {
super(amstcpHeader, amsHeader);
}
@@ -35,7 +35,7 @@ public abstract class ADSAbstractResponse extends AMSTCPPacket {
super(amsHeader);
}
- protected ADSAbstractResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId) {
+ ADSAbstractResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, State.DEFAULT_RESPONSE, invokeId);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAddDeviceNotificationRequest.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAddDeviceNotificationRequest.java
index f1b19c1..240764f 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAddDeviceNotificationRequest.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAddDeviceNotificationRequest.java
@@ -26,7 +26,7 @@ import org.apache.plc4x.java.ads.api.generic.AMSTCPHeader;
import org.apache.plc4x.java.ads.api.generic.types.*;
import org.apache.plc4x.java.ads.api.util.ByteValue;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
/**
* A notification is created in an ADS device.
@@ -66,34 +66,34 @@ public class ADSAddDeviceNotificationRequest extends ADSAbstractRequest {
*/
private final Reserved reserved = Reserved.INSTANCE;
- protected ADSAddDeviceNotificationRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, Length length, TransmissionMode transmissionMode, MaxDelay maxDelay, CycleTime cycleTime) {
+ private ADSAddDeviceNotificationRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, Length length, TransmissionMode transmissionMode, MaxDelay maxDelay, CycleTime cycleTime) {
super(amstcpHeader, amsHeader);
- this.indexGroup = Objects.requireNonNull(indexGroup);
- this.indexOffset = Objects.requireNonNull(indexOffset);
- this.length = Objects.requireNonNull(length);
- this.transmissionMode = Objects.requireNonNull(transmissionMode);
- this.maxDelay = Objects.requireNonNull(maxDelay);
- this.cycleTime = Objects.requireNonNull(cycleTime);
+ this.indexGroup = requireNonNull(indexGroup);
+ this.indexOffset = requireNonNull(indexOffset);
+ this.length = requireNonNull(length);
+ this.transmissionMode = requireNonNull(transmissionMode);
+ this.maxDelay = requireNonNull(maxDelay);
+ this.cycleTime = requireNonNull(cycleTime);
}
- protected ADSAddDeviceNotificationRequest(AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, Length length, TransmissionMode transmissionMode, MaxDelay maxDelay, CycleTime cycleTime) {
+ private ADSAddDeviceNotificationRequest(AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, Length length, TransmissionMode transmissionMode, MaxDelay maxDelay, CycleTime cycleTime) {
super(amsHeader);
- this.indexGroup = Objects.requireNonNull(indexGroup);
- this.indexOffset = Objects.requireNonNull(indexOffset);
- this.length = Objects.requireNonNull(length);
- this.transmissionMode = Objects.requireNonNull(transmissionMode);
- this.maxDelay = Objects.requireNonNull(maxDelay);
- this.cycleTime = Objects.requireNonNull(cycleTime);
+ this.indexGroup = requireNonNull(indexGroup);
+ this.indexOffset = requireNonNull(indexOffset);
+ this.length = requireNonNull(length);
+ this.transmissionMode = requireNonNull(transmissionMode);
+ this.maxDelay = requireNonNull(maxDelay);
+ this.cycleTime = requireNonNull(cycleTime);
}
- protected ADSAddDeviceNotificationRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, IndexGroup indexGroup, IndexOffset indexOffset, Length length, TransmissionMode transmissionMode, MaxDelay maxDelay, CycleTime cycleTime) {
+ private ADSAddDeviceNotificationRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, IndexGroup indexGroup, IndexOffset indexOffset, Length length, TransmissionMode transmissionMode, MaxDelay maxDelay, CycleTime cycleTime) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, State.DEFAULT, invokeId);
- this.indexGroup = Objects.requireNonNull(indexGroup);
- this.indexOffset = Objects.requireNonNull(indexOffset);
- this.length = Objects.requireNonNull(length);
- this.transmissionMode = Objects.requireNonNull(transmissionMode);
- this.maxDelay = Objects.requireNonNull(maxDelay);
- this.cycleTime = Objects.requireNonNull(cycleTime);
+ this.indexGroup = requireNonNull(indexGroup);
+ this.indexOffset = requireNonNull(indexOffset);
+ this.length = requireNonNull(length);
+ this.transmissionMode = requireNonNull(transmissionMode);
+ this.maxDelay = requireNonNull(maxDelay);
+ this.cycleTime = requireNonNull(cycleTime);
}
@Override
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAddDeviceNotificationResponse.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAddDeviceNotificationResponse.java
index a5cf8b7..b9e84f9 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAddDeviceNotificationResponse.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSAddDeviceNotificationResponse.java
@@ -28,7 +28,7 @@ import org.apache.plc4x.java.ads.api.generic.types.AMSPort;
import org.apache.plc4x.java.ads.api.generic.types.Command;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
/**
* A notification is created in an ADS device.
@@ -46,16 +46,16 @@ public class ADSAddDeviceNotificationResponse extends ADSAbstractResponse {
*/
private final NotificationHandle notificationHandle;
- protected ADSAddDeviceNotificationResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result, NotificationHandle notificationHandle) {
+ private ADSAddDeviceNotificationResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result, NotificationHandle notificationHandle) {
super(amstcpHeader, amsHeader);
- this.result = Objects.requireNonNull(result);
- this.notificationHandle = Objects.requireNonNull(notificationHandle);
+ this.result = requireNonNull(result);
+ this.notificationHandle = requireNonNull(notificationHandle);
}
- protected ADSAddDeviceNotificationResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result, NotificationHandle notificationHandle) {
+ private ADSAddDeviceNotificationResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result, NotificationHandle notificationHandle) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
- this.result = Objects.requireNonNull(result);
- this.notificationHandle = Objects.requireNonNull(notificationHandle);
+ this.result = requireNonNull(result);
+ this.notificationHandle = requireNonNull(notificationHandle);
}
public static ADSAddDeviceNotificationResponse of(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result, NotificationHandle notificationHandle) {
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSDeleteDeviceNotificationRequest.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSDeleteDeviceNotificationRequest.java
index ecda040..8353574 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSDeleteDeviceNotificationRequest.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSDeleteDeviceNotificationRequest.java
@@ -27,7 +27,7 @@ import org.apache.plc4x.java.ads.api.generic.types.AMSPort;
import org.apache.plc4x.java.ads.api.generic.types.Command;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
/**
* One before defined notification is deleted in an ADS device.
@@ -40,19 +40,19 @@ public class ADSDeleteDeviceNotificationRequest extends ADSAbstractRequest {
*/
private final NotificationHandle notificationHandle;
- protected ADSDeleteDeviceNotificationRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, NotificationHandle notificationHandle) {
+ private ADSDeleteDeviceNotificationRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, NotificationHandle notificationHandle) {
super(amstcpHeader, amsHeader);
- this.notificationHandle = Objects.requireNonNull(notificationHandle);
+ this.notificationHandle = requireNonNull(notificationHandle);
}
- protected ADSDeleteDeviceNotificationRequest(AMSHeader amsHeader, NotificationHandle notificationHandle) {
+ private ADSDeleteDeviceNotificationRequest(AMSHeader amsHeader, NotificationHandle notificationHandle) {
super(amsHeader);
- this.notificationHandle = Objects.requireNonNull(notificationHandle);
+ this.notificationHandle = requireNonNull(notificationHandle);
}
- protected ADSDeleteDeviceNotificationRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, NotificationHandle notificationHandle) {
+ private ADSDeleteDeviceNotificationRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, NotificationHandle notificationHandle) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
- this.notificationHandle = Objects.requireNonNull(notificationHandle);
+ this.notificationHandle = requireNonNull(notificationHandle);
}
public static ADSDeleteDeviceNotificationRequest of(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, NotificationHandle notificationHandle) {
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSDeleteDeviceNotificationResponse.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSDeleteDeviceNotificationResponse.java
index 688a95c..617b9a7 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSDeleteDeviceNotificationResponse.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSDeleteDeviceNotificationResponse.java
@@ -27,7 +27,7 @@ import org.apache.plc4x.java.ads.api.generic.types.AMSPort;
import org.apache.plc4x.java.ads.api.generic.types.Command;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
/**
* One before defined notification is deleted in an ADS device.
@@ -40,14 +40,14 @@ public class ADSDeleteDeviceNotificationResponse extends ADSAbstractResponse {
*/
private final Result result;
- protected ADSDeleteDeviceNotificationResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result) {
+ private ADSDeleteDeviceNotificationResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result) {
super(amstcpHeader, amsHeader);
- this.result = Objects.requireNonNull(result);
+ this.result = requireNonNull(result);
}
- protected ADSDeleteDeviceNotificationResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result) {
+ private ADSDeleteDeviceNotificationResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
- this.result = Objects.requireNonNull(result);
+ this.result = requireNonNull(result);
}
public static ADSDeleteDeviceNotificationResponse of(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result) {
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSDeviceNotificationRequest.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSDeviceNotificationRequest.java
index da7c9ab..118d82f 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSDeviceNotificationRequest.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSDeviceNotificationRequest.java
@@ -32,7 +32,8 @@ import org.apache.plc4x.java.ads.api.util.ByteReadable;
import org.apache.plc4x.java.ads.api.util.LengthSupplier;
import java.util.List;
-import java.util.Objects;
+
+import static java.util.Objects.requireNonNull;
/**
* Data will carry forward independently from an ADS device to a Client
@@ -62,29 +63,29 @@ public class ADSDeviceNotificationRequest extends ADSAbstractRequest {
//
///
- protected ADSDeviceNotificationRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Length length, Stamps stamps, List<AdsStampHeader> adsStampHeaders) {
+ private ADSDeviceNotificationRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Length length, Stamps stamps, List<AdsStampHeader> adsStampHeaders) {
super(amstcpHeader, amsHeader);
- this.length = Objects.requireNonNull(length);
- this.stamps = Objects.requireNonNull(stamps);
- this.adsStampHeaders = Objects.requireNonNull(adsStampHeaders);
+ this.length = requireNonNull(length);
+ this.stamps = requireNonNull(stamps);
+ this.adsStampHeaders = requireNonNull(adsStampHeaders);
calculated = false;
lengthSupplier = null;
}
- protected ADSDeviceNotificationRequest(AMSHeader amsHeader, Length length, Stamps stamps, List<AdsStampHeader> adsStampHeaders) {
+ private ADSDeviceNotificationRequest(AMSHeader amsHeader, Length length, Stamps stamps, List<AdsStampHeader> adsStampHeaders) {
super(amsHeader);
- this.length = Objects.requireNonNull(length);
- this.stamps = Objects.requireNonNull(stamps);
- this.adsStampHeaders = Objects.requireNonNull(adsStampHeaders);
+ this.length = requireNonNull(length);
+ this.stamps = requireNonNull(stamps);
+ this.adsStampHeaders = requireNonNull(adsStampHeaders);
calculated = false;
lengthSupplier = null;
}
- protected ADSDeviceNotificationRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Stamps stamps, List<AdsStampHeader> adsStampHeaders) {
+ private ADSDeviceNotificationRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Stamps stamps, List<AdsStampHeader> adsStampHeaders) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
this.length = null;
- this.stamps = Objects.requireNonNull(stamps);
- this.adsStampHeaders = Objects.requireNonNull(adsStampHeaders);
+ this.stamps = requireNonNull(stamps);
+ this.adsStampHeaders = requireNonNull(adsStampHeaders);
calculated = true;
this.lengthSupplier = () -> {
long aggregateLength = 0;
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadDeviceInfoRequest.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadDeviceInfoRequest.java
index 3244406..8b5c44f 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadDeviceInfoRequest.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadDeviceInfoRequest.java
@@ -34,15 +34,15 @@ import org.apache.plc4x.java.ads.api.generic.types.Invoke;
@ADSCommandType(Command.ADS_Read_Device_Info)
public class ADSReadDeviceInfoRequest extends ADSAbstractRequest {
- protected ADSReadDeviceInfoRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader) {
+ private ADSReadDeviceInfoRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader) {
super(amstcpHeader, amsHeader);
}
- protected ADSReadDeviceInfoRequest(AMSHeader amsHeader) {
+ private ADSReadDeviceInfoRequest(AMSHeader amsHeader) {
super(amsHeader);
}
- protected ADSReadDeviceInfoRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId) {
+ private ADSReadDeviceInfoRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadDeviceInfoResponse.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadDeviceInfoResponse.java
index ffccbb6..62f213f 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadDeviceInfoResponse.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadDeviceInfoResponse.java
@@ -27,7 +27,7 @@ import org.apache.plc4x.java.ads.api.generic.types.AMSPort;
import org.apache.plc4x.java.ads.api.generic.types.Command;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
/**
* Reads the name and the version number of the ADS device.
@@ -56,22 +56,22 @@ public class ADSReadDeviceInfoResponse extends ADSAbstractResponse {
private final Device device;
- protected ADSReadDeviceInfoResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result, MajorVersion majorVersion, MinorVersion minorVersion, Version version, Device device) {
+ private ADSReadDeviceInfoResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result, MajorVersion majorVersion, MinorVersion minorVersion, Version version, Device device) {
super(amstcpHeader, amsHeader);
- this.result = Objects.requireNonNull(result);
- this.majorVersion = Objects.requireNonNull(majorVersion);
- this.minorVersion = Objects.requireNonNull(minorVersion);
- this.version = Objects.requireNonNull(version);
- this.device = Objects.requireNonNull(device);
+ this.result = requireNonNull(result);
+ this.majorVersion = requireNonNull(majorVersion);
+ this.minorVersion = requireNonNull(minorVersion);
+ this.version = requireNonNull(version);
+ this.device = requireNonNull(device);
}
- protected ADSReadDeviceInfoResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result, MajorVersion majorVersion, MinorVersion minorVersion, Version version, Device device) {
+ private ADSReadDeviceInfoResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result, MajorVersion majorVersion, MinorVersion minorVersion, Version version, Device device) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
- this.result = Objects.requireNonNull(result);
- this.majorVersion = Objects.requireNonNull(majorVersion);
- this.minorVersion = Objects.requireNonNull(minorVersion);
- this.version = Objects.requireNonNull(version);
- this.device = Objects.requireNonNull(device);
+ this.result = requireNonNull(result);
+ this.majorVersion = requireNonNull(majorVersion);
+ this.minorVersion = requireNonNull(minorVersion);
+ this.version = requireNonNull(version);
+ this.device = requireNonNull(device);
}
public static ADSReadDeviceInfoResponse of(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result, MajorVersion majorVersion, MinorVersion minorVersion, Version version, Device device) {
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadRequest.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadRequest.java
index 2c0356b..3cd9c31 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadRequest.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadRequest.java
@@ -29,7 +29,7 @@ import org.apache.plc4x.java.ads.api.generic.types.AMSPort;
import org.apache.plc4x.java.ads.api.generic.types.Command;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
/**
* With ADS Read data can be read from an ADS device. The data are addressed by the Index Group and the Index Offset
@@ -52,25 +52,25 @@ public class ADSReadRequest extends ADSAbstractRequest {
*/
private final Length length;
- protected ADSReadRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, Length length) {
+ private ADSReadRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, Length length) {
super(amstcpHeader, amsHeader);
- this.indexGroup = Objects.requireNonNull(indexGroup);
- this.indexOffset = Objects.requireNonNull(indexOffset);
- this.length = Objects.requireNonNull(length);
+ this.indexGroup = requireNonNull(indexGroup);
+ this.indexOffset = requireNonNull(indexOffset);
+ this.length = requireNonNull(length);
}
- protected ADSReadRequest(AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, Length length) {
+ private ADSReadRequest(AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, Length length) {
super(amsHeader);
- this.indexGroup = Objects.requireNonNull(indexGroup);
- this.indexOffset = Objects.requireNonNull(indexOffset);
- this.length = Objects.requireNonNull(length);
+ this.indexGroup = requireNonNull(indexGroup);
+ this.indexOffset = requireNonNull(indexOffset);
+ this.length = requireNonNull(length);
}
- protected ADSReadRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, IndexGroup indexGroup, IndexOffset indexOffset, Length length) {
+ private ADSReadRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, IndexGroup indexGroup, IndexOffset indexOffset, Length length) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
- this.indexGroup = Objects.requireNonNull(indexGroup);
- this.indexOffset = Objects.requireNonNull(indexOffset);
- this.length = Objects.requireNonNull(length);
+ this.indexGroup = requireNonNull(indexGroup);
+ this.indexOffset = requireNonNull(indexOffset);
+ this.length = requireNonNull(length);
}
public static ADSReadRequest of(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, Length length) {
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadResponse.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadResponse.java
index a4668ed..4f51356 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadResponse.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadResponse.java
@@ -30,7 +30,7 @@ import org.apache.plc4x.java.ads.api.generic.types.Command;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
import org.apache.plc4x.java.ads.api.util.LengthSupplier;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
/**
* With ADS Read data can be read from an ADS device
@@ -58,22 +58,22 @@ public class ADSReadResponse extends ADSAbstractResponse {
//
///
- protected ADSReadResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result, Length length, Data data) {
+ private ADSReadResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result, Length length, Data data) {
super(amstcpHeader, amsHeader);
- this.result = Objects.requireNonNull(result);
- this.length = Objects.requireNonNull(length);
- this.data = Objects.requireNonNull(data);
+ this.result = requireNonNull(result);
+ this.length = requireNonNull(length);
+ this.data = requireNonNull(data);
this.lengthSupplier = null;
this.calculated = false;
}
- protected ADSReadResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result, Data data) {
+ private ADSReadResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result, Data data) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
- this.result = Objects.requireNonNull(result);
+ this.result = requireNonNull(result);
this.length = null;
- this.data = Objects.requireNonNull(data);
- this.lengthSupplier = () -> data.getCalculatedLength();
- this.calculated = Objects.requireNonNull(true);
+ this.data = requireNonNull(data);
+ this.lengthSupplier = data;
+ this.calculated = true;
}
public static ADSReadResponse of(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result, Length length, Data data) {
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadStateRequest.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadStateRequest.java
index 1045cba..6c91758 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadStateRequest.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadStateRequest.java
@@ -34,15 +34,15 @@ import org.apache.plc4x.java.ads.api.generic.types.Invoke;
@ADSCommandType(Command.ADS_Read_State)
public class ADSReadStateRequest extends ADSAbstractRequest {
- protected ADSReadStateRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader) {
+ private ADSReadStateRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader) {
super(amstcpHeader, amsHeader);
}
- protected ADSReadStateRequest(AMSHeader amsHeader) {
+ private ADSReadStateRequest(AMSHeader amsHeader) {
super(amsHeader);
}
- protected ADSReadStateRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId) {
+ private ADSReadStateRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadStateResponse.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadStateResponse.java
index 6c3d08b..b466dd7 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadStateResponse.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadStateResponse.java
@@ -27,7 +27,7 @@ import org.apache.plc4x.java.ads.api.generic.types.AMSPort;
import org.apache.plc4x.java.ads.api.generic.types.Command;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
/**
* Reads the ADS status and the device status of an ADS device.
@@ -40,14 +40,14 @@ public class ADSReadStateResponse extends ADSAbstractResponse {
*/
private final Result result;
- protected ADSReadStateResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result) {
+ private ADSReadStateResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result) {
super(amstcpHeader, amsHeader);
- this.result = Objects.requireNonNull(result);
+ this.result = requireNonNull(result);
}
- protected ADSReadStateResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result) {
+ private ADSReadStateResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
- this.result = Objects.requireNonNull(result);
+ this.result = requireNonNull(result);
}
public static ADSReadStateResponse of(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result) {
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadWriteRequest.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadWriteRequest.java
index 89b9b7f..85544d2 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadWriteRequest.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadWriteRequest.java
@@ -28,7 +28,7 @@ import org.apache.plc4x.java.ads.api.generic.types.Command;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
import org.apache.plc4x.java.ads.api.util.LengthSupplier;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
/**
* With ADS Read Write data will be written to an ADS device. Additionally, data can be read from the ADS device.
@@ -66,36 +66,36 @@ public class ADSReadWriteRequest extends ADSAbstractRequest {
//
///
- protected ADSReadWriteRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, ReadLength readLength, WriteLength writeLength, Data data) {
+ private ADSReadWriteRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, ReadLength readLength, WriteLength writeLength, Data data) {
super(amstcpHeader, amsHeader);
- this.indexGroup = Objects.requireNonNull(indexGroup);
- this.indexOffset = Objects.requireNonNull(indexOffset);
- this.readLength = Objects.requireNonNull(readLength);
- this.writeLength = Objects.requireNonNull(writeLength);
- this.data = Objects.requireNonNull(data);
+ this.indexGroup = requireNonNull(indexGroup);
+ this.indexOffset = requireNonNull(indexOffset);
+ this.readLength = requireNonNull(readLength);
+ this.writeLength = requireNonNull(writeLength);
+ this.data = requireNonNull(data);
this.lengthSupplier = null;
this.calculated = false;
}
- protected ADSReadWriteRequest(AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, ReadLength readLength, WriteLength writeLength, Data data) {
+ private ADSReadWriteRequest(AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, ReadLength readLength, WriteLength writeLength, Data data) {
super(amsHeader);
- this.indexGroup = Objects.requireNonNull(indexGroup);
- this.indexOffset = Objects.requireNonNull(indexOffset);
- this.readLength = Objects.requireNonNull(readLength);
- this.writeLength = Objects.requireNonNull(writeLength);
- this.data = Objects.requireNonNull(data);
+ this.indexGroup = requireNonNull(indexGroup);
+ this.indexOffset = requireNonNull(indexOffset);
+ this.readLength = requireNonNull(readLength);
+ this.writeLength = requireNonNull(writeLength);
+ this.data = requireNonNull(data);
this.lengthSupplier = null;
this.calculated = false;
}
- protected ADSReadWriteRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, IndexGroup indexGroup, IndexOffset indexOffset, ReadLength readLength, Data data) {
+ private ADSReadWriteRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, IndexGroup indexGroup, IndexOffset indexOffset, ReadLength readLength, Data data) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
- this.indexGroup = Objects.requireNonNull(indexGroup);
- this.indexOffset = Objects.requireNonNull(indexOffset);
- this.readLength = Objects.requireNonNull(readLength);
+ this.indexGroup = requireNonNull(indexGroup);
+ this.indexOffset = requireNonNull(indexOffset);
+ this.readLength = requireNonNull(readLength);
this.writeLength = null;
- this.data = Objects.requireNonNull(data);
- this.lengthSupplier = () -> data.getCalculatedLength();
+ this.data = requireNonNull(data);
+ this.lengthSupplier = data;
this.calculated = true;
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadWriteResponse.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadWriteResponse.java
index 3230f0e..5f3c333 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadWriteResponse.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSReadWriteResponse.java
@@ -30,7 +30,7 @@ import org.apache.plc4x.java.ads.api.generic.types.Command;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
import org.apache.plc4x.java.ads.api.util.LengthSupplier;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
/**
* With ADS Read Write data will be written to an ADS device. Additionally, data can be read from the ADS device.
@@ -60,21 +60,21 @@ public class ADSReadWriteResponse extends ADSAbstractResponse {
//
///
- protected ADSReadWriteResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result, Length length, Data data) {
+ private ADSReadWriteResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result, Length length, Data data) {
super(amstcpHeader, amsHeader);
- this.result = Objects.requireNonNull(result);
- this.length = Objects.requireNonNull(length);
- this.data = Objects.requireNonNull(data);
+ this.result = requireNonNull(result);
+ this.length = requireNonNull(length);
+ this.data = requireNonNull(data);
this.lengthSupplier = null;
this.calculated = false;
}
- protected ADSReadWriteResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result, Data data) {
+ private ADSReadWriteResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result, Data data) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
- this.result = Objects.requireNonNull(result);
+ this.result = requireNonNull(result);
this.length = null;
- this.data = Objects.requireNonNull(data);
- this.lengthSupplier = () -> data.getCalculatedLength();
+ this.data = requireNonNull(data);
+ this.lengthSupplier = data;
this.calculated = true;
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteControlRequest.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteControlRequest.java
index e9e7845..35d12a2 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteControlRequest.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteControlRequest.java
@@ -31,7 +31,7 @@ import org.apache.plc4x.java.ads.api.generic.types.Command;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
import org.apache.plc4x.java.ads.api.util.LengthSupplier;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
/**
* Changes the ADS status and the device status of an ADS device.
@@ -65,32 +65,32 @@ public class ADSWriteControlRequest extends ADSAbstractRequest {
//
///
- protected ADSWriteControlRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, ADSState adsState, DeviceState deviceState, Length length, Data data) {
+ private ADSWriteControlRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, ADSState adsState, DeviceState deviceState, Length length, Data data) {
super(amstcpHeader, amsHeader);
- this.adsState = Objects.requireNonNull(adsState);
- this.deviceState = Objects.requireNonNull(deviceState);
- this.length = Objects.requireNonNull(length);
- this.data = Objects.requireNonNull(data);
+ this.adsState = requireNonNull(adsState);
+ this.deviceState = requireNonNull(deviceState);
+ this.length = requireNonNull(length);
+ this.data = requireNonNull(data);
this.lengthSupplier = null;
this.calculated = false;
}
- protected ADSWriteControlRequest(AMSHeader amsHeader, ADSState adsState, DeviceState deviceState, Length length, Data data) {
+ private ADSWriteControlRequest(AMSHeader amsHeader, ADSState adsState, DeviceState deviceState, Length length, Data data) {
super(amsHeader);
- this.adsState = Objects.requireNonNull(adsState);
- this.deviceState = Objects.requireNonNull(deviceState);
- this.length = Objects.requireNonNull(length);
- this.data = Objects.requireNonNull(data);
+ this.adsState = requireNonNull(adsState);
+ this.deviceState = requireNonNull(deviceState);
+ this.length = requireNonNull(length);
+ this.data = requireNonNull(data);
this.lengthSupplier = null;
this.calculated = false;
}
- protected ADSWriteControlRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, ADSState adsState, DeviceState deviceState, Data data) {
+ private ADSWriteControlRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, ADSState adsState, DeviceState deviceState, Data data) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
- this.adsState = Objects.requireNonNull(adsState);
- this.deviceState = Objects.requireNonNull(deviceState);
+ this.adsState = requireNonNull(adsState);
+ this.deviceState = requireNonNull(deviceState);
this.length = null;
- this.data = Objects.requireNonNull(data);
+ this.data = requireNonNull(data);
this.lengthSupplier = data;
this.calculated = true;
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteControlResponse.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteControlResponse.java
index 207e9bd..a07ab68 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteControlResponse.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteControlResponse.java
@@ -27,7 +27,7 @@ import org.apache.plc4x.java.ads.api.generic.types.AMSPort;
import org.apache.plc4x.java.ads.api.generic.types.Command;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
/**
* Changes the ADS status and the device status of an ADS device.
@@ -39,14 +39,14 @@ public class ADSWriteControlResponse extends ADSAbstractResponse {
*/
private final Result result;
- protected ADSWriteControlResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result) {
+ private ADSWriteControlResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result) {
super(amstcpHeader, amsHeader);
- this.result = Objects.requireNonNull(result);
+ this.result = requireNonNull(result);
}
- protected ADSWriteControlResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result) {
+ private ADSWriteControlResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
- this.result = Objects.requireNonNull(result);
+ this.result = requireNonNull(result);
}
public static ADSWriteControlResponse of(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result) {
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteRequest.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteRequest.java
index bd3d054..6ff4bd3 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteRequest.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteRequest.java
@@ -28,7 +28,7 @@ import org.apache.plc4x.java.ads.api.generic.types.Command;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
import org.apache.plc4x.java.ads.api.util.LengthSupplier;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
/**
* With ADS Write data can be written to an ADS device. The data are addressed by the Index Group and the Index Offset.
@@ -60,33 +60,33 @@ public class ADSWriteRequest extends ADSAbstractRequest {
//
///
- protected ADSWriteRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, Length length, Data data) {
+ private ADSWriteRequest(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, Length length, Data data) {
super(amstcpHeader, amsHeader);
- this.indexGroup = Objects.requireNonNull(indexGroup);
- this.indexOffset = Objects.requireNonNull(indexOffset);
- this.length = Objects.requireNonNull(length);
- this.data = Objects.requireNonNull(data);
+ this.indexGroup = requireNonNull(indexGroup);
+ this.indexOffset = requireNonNull(indexOffset);
+ this.length = requireNonNull(length);
+ this.data = requireNonNull(data);
this.lengthSupplier = null;
this.calculated = false;
}
- protected ADSWriteRequest(AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, Length length, Data data) {
+ private ADSWriteRequest(AMSHeader amsHeader, IndexGroup indexGroup, IndexOffset indexOffset, Length length, Data data) {
super(amsHeader);
- this.indexGroup = Objects.requireNonNull(indexGroup);
- this.indexOffset = Objects.requireNonNull(indexOffset);
- this.length = Objects.requireNonNull(length);
- this.data = Objects.requireNonNull(data);
+ this.indexGroup = requireNonNull(indexGroup);
+ this.indexOffset = requireNonNull(indexOffset);
+ this.length = requireNonNull(length);
+ this.data = requireNonNull(data);
this.lengthSupplier = null;
this.calculated = false;
}
- protected ADSWriteRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, IndexGroup indexGroup, IndexOffset indexOffset, Data data) {
+ private ADSWriteRequest(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, IndexGroup indexGroup, IndexOffset indexOffset, Data data) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
- this.indexGroup = Objects.requireNonNull(indexGroup);
- this.indexOffset = Objects.requireNonNull(indexOffset);
+ this.indexGroup = requireNonNull(indexGroup);
+ this.indexOffset = requireNonNull(indexOffset);
this.length = null;
- this.data = Objects.requireNonNull(data);
- this.lengthSupplier = () -> data.getCalculatedLength();
+ this.data = requireNonNull(data);
+ this.lengthSupplier = data;
this.calculated = true;
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteResponse.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteResponse.java
index a2f7a1b..3569235 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteResponse.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/ADSWriteResponse.java
@@ -27,7 +27,7 @@ import org.apache.plc4x.java.ads.api.generic.types.AMSPort;
import org.apache.plc4x.java.ads.api.generic.types.Command;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
/**
* With ADS Write data can be written to an ADS device.
@@ -40,14 +40,14 @@ public class ADSWriteResponse extends ADSAbstractResponse {
*/
private final Result result;
- protected ADSWriteResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result) {
+ private ADSWriteResponse(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result) {
super(amstcpHeader, amsHeader);
- this.result = Objects.requireNonNull(result);
+ this.result = requireNonNull(result);
}
- protected ADSWriteResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result) {
+ private ADSWriteResponse(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Invoke invokeId, Result result) {
super(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId);
- this.result = Objects.requireNonNull(result);
+ this.result = requireNonNull(result);
}
public static ADSWriteResponse of(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, Result result) {
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/UnknownCommand.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/UnknownCommand.java
index 3e2c6ee..77c3bbe 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/UnknownCommand.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/UnknownCommand.java
@@ -25,7 +25,7 @@ import org.apache.plc4x.java.ads.api.generic.AMSTCPHeader;
import org.apache.plc4x.java.ads.api.generic.AMSTCPPacket;
import org.apache.plc4x.java.ads.api.generic.types.Command;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
/**
* Unknown ADS Package
@@ -33,11 +33,11 @@ import java.util.Objects;
@ADSCommandType(Command.UNKNOWN)
public class UnknownCommand extends AMSTCPPacket {
- final ByteBuf remainingBytes;
+ private final ByteBuf remainingBytes;
- protected UnknownCommand(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, ByteBuf remainingBytes) {
+ private UnknownCommand(AMSTCPHeader amstcpHeader, AMSHeader amsHeader, ByteBuf remainingBytes) {
super(amstcpHeader, amsHeader);
- this.remainingBytes = Objects.requireNonNull(remainingBytes);
+ this.remainingBytes = requireNonNull(remainingBytes);
}
@Override
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/ADSState.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/ADSState.java
index cb05cc0..a3e606a 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/ADSState.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/ADSState.java
@@ -25,19 +25,19 @@ public class ADSState extends UnsignedShortLEByteValue {
public static final int NUM_BYTES = UnsignedShortLEByteValue.NUM_BYTES;
- protected ADSState(byte... values) {
+ private ADSState(byte... values) {
super(values);
}
- protected ADSState(int value) {
+ private ADSState(int value) {
super(value);
}
- public ADSState(String value) {
+ private ADSState(String value) {
super(value);
}
- protected ADSState(ByteBuf byteBuf) {
+ private ADSState(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/AdsNotificationSample.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/AdsNotificationSample.java
index 0f224fa..bb7f244 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/AdsNotificationSample.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/AdsNotificationSample.java
@@ -22,8 +22,7 @@ import io.netty.buffer.ByteBuf;
import org.apache.plc4x.java.ads.api.util.ByteReadable;
import org.apache.plc4x.java.ads.api.util.LengthSupplier;
-import java.util.Objects;
-
+import static java.util.Objects.requireNonNull;
import static org.apache.plc4x.java.ads.api.util.ByteReadableUtils.buildByteBuff;
public class AdsNotificationSample implements ByteReadable {
@@ -48,18 +47,18 @@ public class AdsNotificationSample implements ByteReadable {
//
///
- protected AdsNotificationSample(NotificationHandle notificationHandle, Data data) {
- this.notificationHandle = Objects.requireNonNull(notificationHandle);
+ private AdsNotificationSample(NotificationHandle notificationHandle, Data data) {
+ this.notificationHandle = requireNonNull(notificationHandle);
this.sampleSize = null;
- this.data = Objects.requireNonNull(data);
+ this.data = requireNonNull(data);
calculated = true;
- lengthSupplier = () -> data.getCalculatedLength();
+ lengthSupplier = data;
}
- protected AdsNotificationSample(NotificationHandle notificationHandle, SampleSize sampleSize, Data data) {
- this.notificationHandle = Objects.requireNonNull(notificationHandle);
- this.sampleSize = Objects.requireNonNull(sampleSize);
- this.data = Objects.requireNonNull(data);
+ private AdsNotificationSample(NotificationHandle notificationHandle, SampleSize sampleSize, Data data) {
+ this.notificationHandle = requireNonNull(notificationHandle);
+ this.sampleSize = requireNonNull(sampleSize);
+ this.data = requireNonNull(data);
calculated = true;
lengthSupplier = null;
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/AdsReturnCode.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/AdsReturnCode.java
index 8a1e941..ab1bfb3 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/AdsReturnCode.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/AdsReturnCode.java
@@ -18,9 +18,8 @@
*/
package org.apache.plc4x.java.ads.api.commands.types;
-import java.util.Objects;
-
import static java.lang.Long.toHexString;
+import static java.util.Objects.requireNonNull;
/**
* Based on spec from: https://infosys.beckhoff.com/content/1033/tcadscommon/html/ads_returncodes.htm
@@ -163,11 +162,11 @@ public enum AdsReturnCode {
ADS_CODE_10065(0x2751, 10065, "No connection could be made because the target machine actively refused it", "", ""),
UNKNOWN(0, 0, "", "", "");
- long hex;
- long dec;
- String description;
- String possibleCauses;
- String solution;
+ private final long hex;
+ private final long dec;
+ private final String description;
+ private final String possibleCauses;
+ private final String solution;
AdsReturnCode(long hex, long dec, String description, String possibleCauses, String solution) {
this.hex = hex;
@@ -175,7 +174,7 @@ public enum AdsReturnCode {
if (hex != dec) {
throw new IllegalArgumentException("hex " + hex + " is different from dec " + dec);
}
- this.description = Objects.requireNonNull(description);
+ this.description = requireNonNull(description);
this.possibleCauses = possibleCauses;
this.solution = solution;
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/AdsStampHeader.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/AdsStampHeader.java
index 01547d8..d66adce 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/AdsStampHeader.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/AdsStampHeader.java
@@ -22,8 +22,8 @@ import io.netty.buffer.ByteBuf;
import org.apache.plc4x.java.ads.api.util.ByteReadable;
import java.util.List;
-import java.util.Objects;
+import static java.util.Objects.requireNonNull;
import static org.apache.plc4x.java.ads.api.util.ByteReadableUtils.buildByteBuff;
public class AdsStampHeader implements ByteReadable {
@@ -41,15 +41,15 @@ public class AdsStampHeader implements ByteReadable {
*/
private final List<AdsNotificationSample> adsNotificationSamples;
- protected AdsStampHeader(TimeStamp timeStamp, Samples samples, List<AdsNotificationSample> adsNotificationSamples) {
- this.timeStamp = Objects.requireNonNull(timeStamp);
- this.samples = Objects.requireNonNull(samples);
- this.adsNotificationSamples = Objects.requireNonNull(adsNotificationSamples);
+ private AdsStampHeader(TimeStamp timeStamp, Samples samples, List<AdsNotificationSample> adsNotificationSamples) {
+ this.timeStamp = requireNonNull(timeStamp);
+ this.samples = requireNonNull(samples);
+ this.adsNotificationSamples = requireNonNull(adsNotificationSamples);
}
- protected AdsStampHeader(TimeStamp timeStamp, List<AdsNotificationSample> adsNotificationSamples) {
- this.timeStamp = Objects.requireNonNull(timeStamp);
- this.adsNotificationSamples = Objects.requireNonNull(adsNotificationSamples);
+ private AdsStampHeader(TimeStamp timeStamp, List<AdsNotificationSample> adsNotificationSamples) {
+ this.timeStamp = requireNonNull(timeStamp);
+ this.adsNotificationSamples = requireNonNull(adsNotificationSamples);
this.samples = Samples.of(adsNotificationSamples.size());
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/CycleTime.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/CycleTime.java
index 216f0a2..b0f457d 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/CycleTime.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/CycleTime.java
@@ -25,19 +25,19 @@ public class CycleTime extends UnsignedIntLEByteValue {
public static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
- protected CycleTime(byte... values) {
+ private CycleTime(byte... values) {
super(values);
}
- protected CycleTime(long value) {
+ private CycleTime(long value) {
super(value);
}
- protected CycleTime(ByteBuf byteBuf) {
+ private CycleTime(ByteBuf byteBuf) {
super(byteBuf);
}
- public CycleTime(String value) {
+ private CycleTime(String value) {
super(value);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Data.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Data.java
index c4e00c3..c820317 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Data.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Data.java
@@ -21,10 +21,12 @@ package org.apache.plc4x.java.ads.api.commands.types;
import org.apache.plc4x.java.ads.api.util.ByteValue;
import java.nio.charset.Charset;
-import java.util.Objects;
+
+import static java.util.Objects.requireNonNull;
public class Data extends ByteValue {
- Data(byte... values) {
+
+ private Data(byte... values) {
super(values);
}
@@ -33,12 +35,12 @@ public class Data extends ByteValue {
}
public static Data of(String value) {
- Objects.requireNonNull(value);
+ requireNonNull(value);
return new Data(value.getBytes());
}
public static Data of(String value, Charset charset) {
- Objects.requireNonNull(value);
+ requireNonNull(value);
return new Data(value.getBytes(charset));
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Device.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Device.java
index 3814400..69f43f7 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Device.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Device.java
@@ -22,13 +22,14 @@ import io.netty.buffer.ByteBuf;
import org.apache.plc4x.java.ads.api.util.ByteValue;
import java.nio.charset.Charset;
-import java.util.Objects;
+
+import static java.util.Objects.requireNonNull;
public class Device extends ByteValue {
- public static final int NUM_BYTES = 16;
+ private static final int NUM_BYTES = 16;
- protected Device(byte... values) {
+ private Device(byte... values) {
super(values);
assertLength(NUM_BYTES);
}
@@ -44,12 +45,12 @@ public class Device extends ByteValue {
}
public static Device of(String value) {
- Objects.requireNonNull(value);
+ requireNonNull(value);
return new Device(value.getBytes());
}
public static Device of(String value, Charset charset) {
- Objects.requireNonNull(value);
+ requireNonNull(value);
return new Device(value.getBytes(charset));
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/DeviceState.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/DeviceState.java
index ae219da..13bfe7a 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/DeviceState.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/DeviceState.java
@@ -25,19 +25,19 @@ public class DeviceState extends UnsignedShortLEByteValue {
public static final int NUM_BYTES = UnsignedShortLEByteValue.NUM_BYTES;
- protected DeviceState(byte... values) {
+ private DeviceState(byte... values) {
super(values);
}
- protected DeviceState(int value) {
+ private DeviceState(int value) {
super(value);
}
- protected DeviceState(String value) {
+ private DeviceState(String value) {
super(value);
}
- protected DeviceState(ByteBuf byteBuf) {
+ private DeviceState(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/IndexGroup.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/IndexGroup.java
index f4998f7..3e57314 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/IndexGroup.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/IndexGroup.java
@@ -25,19 +25,19 @@ public class IndexGroup extends UnsignedIntLEByteValue {
public static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
- protected IndexGroup(byte... values) {
+ private IndexGroup(byte... values) {
super(values);
}
- protected IndexGroup(long value) {
+ private IndexGroup(long value) {
super(value);
}
- protected IndexGroup(String value) {
+ private IndexGroup(String value) {
super(value);
}
- protected IndexGroup(ByteBuf byteBuf) {
+ private IndexGroup(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/IndexOffset.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/IndexOffset.java
index 67bb3a1..60011c6 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/IndexOffset.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/IndexOffset.java
@@ -25,19 +25,19 @@ public class IndexOffset extends UnsignedIntLEByteValue {
public static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
- protected IndexOffset(byte... values) {
+ private IndexOffset(byte... values) {
super(values);
}
- protected IndexOffset(long value) {
+ private IndexOffset(long value) {
super(value);
}
- protected IndexOffset(String value) {
+ private IndexOffset(String value) {
super(value);
}
- protected IndexOffset(ByteBuf byteBuf) {
+ private IndexOffset(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Length.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Length.java
index 7d4693c..ac6c980 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Length.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Length.java
@@ -25,19 +25,19 @@ public class Length extends UnsignedIntLEByteValue {
public static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
- protected Length(byte... values) {
+ private Length(byte... values) {
super(values);
}
- protected Length(long value) {
+ private Length(long value) {
super(value);
}
- protected Length(String length) {
+ private Length(String length) {
super(length);
}
- protected Length(ByteBuf byteBuf) {
+ private Length(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/MajorVersion.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/MajorVersion.java
index 6888b2d..47ca19a 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/MajorVersion.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/MajorVersion.java
@@ -25,14 +25,14 @@ import java.util.Arrays;
public class MajorVersion extends ByteValue {
- public static final int NUM_BYTES = 1;
+ private static final int NUM_BYTES = 1;
- protected MajorVersion(byte... values) {
+ private MajorVersion(byte... values) {
super(values);
assertLength(NUM_BYTES);
}
- public static MajorVersion of(byte... values) {
+ private static MajorVersion of(byte... values) {
return new MajorVersion(values);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/MaxDelay.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/MaxDelay.java
index f381755..b24a780 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/MaxDelay.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/MaxDelay.java
@@ -25,19 +25,19 @@ public class MaxDelay extends UnsignedIntLEByteValue {
public static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
- protected MaxDelay(byte... values) {
+ private MaxDelay(byte... values) {
super(values);
}
- protected MaxDelay(long value) {
+ private MaxDelay(long value) {
super(value);
}
- protected MaxDelay(String value) {
+ private MaxDelay(String value) {
super(value);
}
- protected MaxDelay(ByteBuf byteBuf) {
+ private MaxDelay(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/MinorVersion.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/MinorVersion.java
index 2579e27..a118b44 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/MinorVersion.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/MinorVersion.java
@@ -25,14 +25,14 @@ import java.util.Arrays;
public class MinorVersion extends ByteValue {
- public static final int NUM_BYTES = 1;
+ private static final int NUM_BYTES = 1;
- MinorVersion(byte... values) {
+ private MinorVersion(byte... values) {
super(values);
assertLength(NUM_BYTES);
}
- public static MinorVersion of(byte... values) {
+ private static MinorVersion of(byte... values) {
return new MinorVersion(values);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/NotificationHandle.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/NotificationHandle.java
index 27ebe0a..72a1975 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/NotificationHandle.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/NotificationHandle.java
@@ -25,19 +25,19 @@ public class NotificationHandle extends UnsignedIntLEByteValue {
public static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
- protected NotificationHandle(byte... values) {
+ private NotificationHandle(byte... values) {
super(values);
}
- protected NotificationHandle(long value) {
+ private NotificationHandle(long value) {
super(value);
}
- protected NotificationHandle(ByteBuf byteBuf) {
+ private NotificationHandle(ByteBuf byteBuf) {
super(byteBuf);
}
- protected NotificationHandle(String value) {
+ private NotificationHandle(String value) {
super(value);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/ReadLength.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/ReadLength.java
index d1579bb..8e8384e 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/ReadLength.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/ReadLength.java
@@ -25,19 +25,19 @@ public class ReadLength extends UnsignedIntLEByteValue {
public static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
- protected ReadLength(byte... values) {
+ private ReadLength(byte... values) {
super(values);
}
- protected ReadLength(long value) {
+ private ReadLength(long value) {
super(value);
}
- public ReadLength(String length) {
+ private ReadLength(String length) {
super(length);
}
- protected ReadLength(ByteBuf byteBuf) {
+ private ReadLength(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Result.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Result.java
index 02eb0df..3096e67 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Result.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Result.java
@@ -25,19 +25,19 @@ public class Result extends UnsignedIntLEByteValue {
public static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
- protected Result(byte... values) {
+ private Result(byte... values) {
super(values);
}
- protected Result(long value) {
+ private Result(long value) {
super(value);
}
- public Result(String value) {
+ private Result(String value) {
super(value);
}
- protected Result(ByteBuf byteBuf) {
+ private Result(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/SampleSize.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/SampleSize.java
index 4fe5345..959ad43 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/SampleSize.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/SampleSize.java
@@ -25,19 +25,19 @@ public class SampleSize extends UnsignedIntLEByteValue {
public static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
- protected SampleSize(byte... values) {
+ private SampleSize(byte... values) {
super(values);
}
- protected SampleSize(long value) {
+ private SampleSize(long value) {
super(value);
}
- public SampleSize(String size) {
+ private SampleSize(String size) {
super(size);
}
- protected SampleSize(ByteBuf byteBuf) {
+ private SampleSize(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Samples.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Samples.java
index b44b468..4a120ab 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Samples.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Samples.java
@@ -25,19 +25,19 @@ public class Samples extends UnsignedIntLEByteValue {
public static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
- protected Samples(byte... values) {
+ private Samples(byte... values) {
super(values);
}
- protected Samples(long value) {
+ private Samples(long value) {
super(value);
}
- protected Samples(String value) {
+ private Samples(String value) {
super(value);
}
- protected Samples(ByteBuf byteBuf) {
+ private Samples(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Stamps.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Stamps.java
index d91ba5e..e8580b7 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Stamps.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Stamps.java
@@ -25,19 +25,19 @@ public class Stamps extends UnsignedIntLEByteValue {
public static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
- protected Stamps(byte... values) {
+ private Stamps(byte... values) {
super(values);
}
- protected Stamps(long value) {
+ private Stamps(long value) {
super(value);
}
- protected Stamps(String value) {
+ private Stamps(String value) {
super(value);
}
- protected Stamps(ByteBuf byteBuf) {
+ private Stamps(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/TimeStamp.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/TimeStamp.java
index 4a2981c..2e42d66 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/TimeStamp.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/TimeStamp.java
@@ -30,13 +30,13 @@ public class TimeStamp extends ByteValue {
/**
* @see <a href="https://github.com/java-native-access/jna/blob/master/contrib/platform/src/com/sun/jna/platform/win32/WinBase.java">java-native-access WinBase</a>
*/
- public final static BigInteger EPOCH_DIFF_IN_MILLIS = BigInteger.valueOf((369L * 365L + 89L) * 86400L * 1000L);
+ private final static BigInteger EPOCH_DIFF_IN_MILLIS = BigInteger.valueOf((369L * 365L + 89L) * 86400L * 1000L);
- public static final int NUM_BYTES = 8;
+ private static final int NUM_BYTES = 8;
- protected final BigInteger bigIntegerValue;
+ private final BigInteger bigIntegerValue;
- protected TimeStamp(byte... values) {
+ private TimeStamp(byte... values) {
super(values);
assertLength(NUM_BYTES);
bigIntegerValue = new BigInteger(new byte[]{
@@ -53,13 +53,14 @@ public class TimeStamp extends ByteValue {
});
}
- protected TimeStamp(BigInteger value) {
+ private TimeStamp(BigInteger value) {
super(ofBigInteger(value));
+ checkUnsignedBounds(value, NUM_BYTES);
assertLength(NUM_BYTES);
bigIntegerValue = value;
}
- protected static byte[] ofBigInteger(BigInteger value) {
+ private static byte[] ofBigInteger(BigInteger value) {
byte[] valueBytes = value.toByteArray();
int length = valueBytes.length;
return ByteBuffer.allocate(NUM_BYTES)
@@ -76,7 +77,7 @@ public class TimeStamp extends ByteValue {
.array();
}
- public static TimeStamp of(BigInteger value) {
+ private static TimeStamp of(BigInteger value) {
return new TimeStamp(javaToWinTime(value));
}
@@ -92,7 +93,7 @@ public class TimeStamp extends ByteValue {
return of(javaToWinTime(BigInteger.valueOf(value)));
}
- public static TimeStamp of(byte... values) {
+ private static TimeStamp of(byte... values) {
return new TimeStamp(values);
}
@@ -107,20 +108,20 @@ public class TimeStamp extends ByteValue {
return of(values);
}
- public BigInteger getBigIntegerValue() {
+ private BigInteger getBigIntegerValue() {
return bigIntegerValue;
}
- public Date getAsDate() {
+ private Date getAsDate() {
return new Date(winTimeToJava(bigIntegerValue).longValue());
}
- public static BigInteger javaToWinTime(BigInteger timeMillisSince19700101) {
+ private static BigInteger javaToWinTime(BigInteger timeMillisSince19700101) {
BigInteger timeMillisSince16010101 = EPOCH_DIFF_IN_MILLIS.add(timeMillisSince19700101);
return timeMillisSince16010101.multiply(BigInteger.valueOf(10_000));
}
- public static BigInteger winTimeToJava(BigInteger winTime) {
+ private static BigInteger winTimeToJava(BigInteger winTime) {
BigInteger timeMillisSince16010101 = winTime.divide(BigInteger.valueOf(10_000));
return timeMillisSince16010101.subtract(EPOCH_DIFF_IN_MILLIS);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/TransmissionMode.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/TransmissionMode.java
index c63bde7..07a64ac 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/TransmissionMode.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/TransmissionMode.java
@@ -25,19 +25,19 @@ public class TransmissionMode extends UnsignedIntLEByteValue {
public static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
- protected TransmissionMode(byte... values) {
+ private TransmissionMode(byte... values) {
super(values);
}
- protected TransmissionMode(long value) {
+ private TransmissionMode(long value) {
super(value);
}
- protected TransmissionMode(String value) {
+ private TransmissionMode(String value) {
super(value);
}
- protected TransmissionMode(ByteBuf byteBuf) {
+ private TransmissionMode(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Version.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Version.java
index c9d49d8..09582fb 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Version.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/Version.java
@@ -23,21 +23,21 @@ import org.apache.plc4x.java.ads.api.util.UnsignedShortLEByteValue;
public class Version extends UnsignedShortLEByteValue {
- public static final int NUM_BYTES = UnsignedShortLEByteValue.NUM_BYTES;
+ private static final int NUM_BYTES = UnsignedShortLEByteValue.NUM_BYTES;
- protected Version(byte... values) {
+ private Version(byte... values) {
super(values);
}
- protected Version(int value) {
+ private Version(int value) {
super(value);
}
- protected Version(String value) {
+ private Version(String value) {
super(value);
}
- protected Version(ByteBuf byteBuf) {
+ private Version(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/WriteLength.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/WriteLength.java
index 0f8b8a0..5198fbd 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/WriteLength.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/commands/types/WriteLength.java
@@ -25,19 +25,19 @@ public class WriteLength extends UnsignedIntLEByteValue {
public static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
- protected WriteLength(byte... values) {
+ private WriteLength(byte... values) {
super(values);
}
- protected WriteLength(long value) {
+ private WriteLength(long value) {
super(value);
}
- protected WriteLength(String length) {
+ private WriteLength(String length) {
super(length);
}
- protected WriteLength(ByteBuf byteBuf) {
+ private WriteLength(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSHeader.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSHeader.java
index 679ae4c..ac29459 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSHeader.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSHeader.java
@@ -32,41 +32,41 @@ public class AMSHeader implements ByteReadable {
/**
* This is the AMSNetId of the station, for which the packet is intended. Remarks see below.
*/
- protected final AMSNetId targetAmsNetId;
+ private final AMSNetId targetAmsNetId;
/**
* This is the AMSPort of the station, for which the packet is intended.
*/
- protected final AMSPort targetAmsPort;
+ private final AMSPort targetAmsPort;
/**
* This contains the AMSNetId of the station, from which the packet was sent.
*/
- protected final AMSNetId sourceAmsNetId;
+ private final AMSNetId sourceAmsNetId;
/**
* This contains the AMSPort of the station, from which the packet was sent.
*/
- protected final AMSPort sourceAmsPort;
+ private final AMSPort sourceAmsPort;
/**
* 2 bytes.
*/
- protected final Command commandId;
+ private final Command commandId;
/**
* 2 bytes.
*/
- protected final State stateFlags;
+ private final State stateFlags;
/**
* 4 bytes Size of the data range. The unit is byte.
*/
- protected final DataLength dataLength;
+ private final DataLength dataLength;
/**
* 4 bytes AMS error number. See ADS Return Codes.
*/
- protected final AMSError code;
+ private final AMSError code;
/**
* 4 bytes Free usable 32 bit array. Usually this array serves to send an Id. This Id makes is possible to assign a received response to a request, which was sent before.
*/
- protected final Invoke invokeId;
+ private final Invoke invokeId;
////
// Used when fields should be calculated. TODO: check if we better work with a subclass.
@@ -75,7 +75,7 @@ public class AMSHeader implements ByteReadable {
//
///
- protected AMSHeader(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Command commandId, State stateFlags, DataLength dataLength, AMSError code, Invoke invokeId) {
+ private AMSHeader(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Command commandId, State stateFlags, DataLength dataLength, AMSError code, Invoke invokeId) {
this.targetAmsNetId = requireNonNull(targetAmsNetId);
this.targetAmsPort = requireNonNull(targetAmsPort);
this.sourceAmsNetId = requireNonNull(sourceAmsNetId);
@@ -89,7 +89,7 @@ public class AMSHeader implements ByteReadable {
calculated = false;
}
- protected AMSHeader(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Command commandId, State stateFlags, DataLengthSupplier dataLengthSupplier, AMSError code, Invoke invokeId) {
+ private AMSHeader(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, Command commandId, State stateFlags, DataLengthSupplier dataLengthSupplier, AMSError code, Invoke invokeId) {
this.targetAmsNetId = requireNonNull(targetAmsNetId);
this.targetAmsPort = requireNonNull(targetAmsPort);
this.sourceAmsNetId = requireNonNull(sourceAmsNetId);
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSTCPHeader.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSTCPHeader.java
index b5d18db..613eb60 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSTCPHeader.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSTCPHeader.java
@@ -32,9 +32,9 @@ import static org.apache.plc4x.java.ads.api.util.ByteReadableUtils.buildByteBuff
*/
public class AMSTCPHeader implements ByteReadable {
- protected final Reserved reserved;
+ private final Reserved reserved;
- protected final Length length;
+ private final Length length;
////
// Used when fields should be calculated. TODO: check if we better work with a subclass.
@@ -43,14 +43,14 @@ public class AMSTCPHeader implements ByteReadable {
//
///
- protected AMSTCPHeader(Length length) {
+ private AMSTCPHeader(Length length) {
this.reserved = requireNonNull(Reserved.CONSTANT);
this.length = requireNonNull(length);
lengthSuppliers = null;
calculated = false;
}
- protected AMSTCPHeader(LengthSupplier... lengthSuppliers) {
+ private AMSTCPHeader(LengthSupplier... lengthSuppliers) {
this.reserved = requireNonNull(Reserved.CONSTANT);
this.length = null;
this.lengthSuppliers = requireNonNull(lengthSuppliers);
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSTCPPacket.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSTCPPacket.java
index 2dd7d09..eee17c3 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSTCPPacket.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSTCPPacket.java
@@ -27,23 +27,23 @@ import static java.util.Objects.requireNonNull;
import static org.apache.plc4x.java.ads.api.util.ByteReadableUtils.buildByteBuff;
public abstract class AMSTCPPacket implements ByteReadable {
- private final AMSTCPHeader amstcpHeader;
+ private final AMSTCPHeader amsTcpHeader;
private final AMSHeader amsHeader;
- public AMSTCPPacket(AMSTCPHeader amstcpHeader, AMSHeader amsHeader) {
- this.amstcpHeader = requireNonNull(amstcpHeader);
+ protected AMSTCPPacket(AMSTCPHeader amsTcpHeader, AMSHeader amsHeader) {
+ this.amsTcpHeader = requireNonNull(amsTcpHeader);
this.amsHeader = requireNonNull(amsHeader);
}
- public AMSTCPPacket(AMSHeader amsHeader) {
+ protected AMSTCPPacket(AMSHeader amsHeader) {
// It is important that we wrap the ads data call as this will initialized in the constructor
// so this value will be null if we call adsData now.
- this.amstcpHeader = AMSTCPHeader.of(requireNonNull(amsHeader), () -> getAdsData().getCalculatedLength());
+ this.amsTcpHeader = AMSTCPHeader.of(requireNonNull(amsHeader), () -> getAdsData().getCalculatedLength());
this.amsHeader = requireNonNull(amsHeader);
}
- public AMSTCPPacket(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, State stateId, Invoke invokeId) {
+ protected AMSTCPPacket(AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort, State stateId, Invoke invokeId) {
if (!getClass().isAnnotationPresent(ADSCommandType.class)) {
throw new IllegalArgumentException(ADSCommandType.class + " need to be present.");
}
@@ -57,22 +57,22 @@ public abstract class AMSTCPPacket implements ByteReadable {
() -> getAdsData().getCalculatedLength(),
requireNonNull(AMSError.NONE),
requireNonNull(invokeId));
- this.amstcpHeader = AMSTCPHeader.of(amsHeader, () -> getAdsData().getCalculatedLength());
+ this.amsTcpHeader = AMSTCPHeader.of(amsHeader, () -> getAdsData().getCalculatedLength());
}
- public AMSTCPHeader getAmstcpHeader() {
- return amstcpHeader;
+ public AMSTCPHeader getAmsTcpHeader() {
+ return amsTcpHeader;
}
public AMSHeader getAmsHeader() {
return amsHeader;
}
- public abstract ADSData getAdsData();
+ protected abstract ADSData getAdsData();
@Override
public ByteBuf getByteBuf() {
- return buildByteBuff(amstcpHeader, amsHeader, getAdsData());
+ return buildByteBuff(amsTcpHeader, amsHeader, getAdsData());
}
protected ADSData buildADSData(ByteReadable... byteReadables) {
@@ -82,7 +82,7 @@ public abstract class AMSTCPPacket implements ByteReadable {
@Override
public String toString() {
return getClass().getSimpleName() + "{" +
- "amstcpHeader=" + amstcpHeader +
+ "amsTcpHeader=" + amsTcpHeader +
", amsHeader=" + amsHeader +
'}';
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSError.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSError.java
index d829933..de115ed 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSError.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSError.java
@@ -24,19 +24,19 @@ import org.apache.plc4x.java.ads.api.util.UnsignedIntLEByteValue;
public class AMSError extends UnsignedIntLEByteValue {
- public static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
+ private static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
public static final AMSError NONE = of(0);
- protected AMSError(byte... values) {
+ private AMSError(byte... values) {
super(values);
}
- protected AMSError(long value) {
+ private AMSError(long value) {
super(value);
}
- protected AMSError(ByteBuf byteBuf) {
+ private AMSError(ByteBuf byteBuf) {
super(byteBuf);
}
@@ -44,7 +44,7 @@ public class AMSError extends UnsignedIntLEByteValue {
return new AMSError(values);
}
- public static AMSError of(long errorCode) {
+ private static AMSError of(long errorCode) {
checkUnsignedBounds(errorCode, NUM_BYTES);
return new AMSError(errorCode);
}
@@ -53,7 +53,7 @@ public class AMSError extends UnsignedIntLEByteValue {
return new AMSError(byteBuf);
}
- public AdsReturnCode toAdsReturnCode() {
+ private AdsReturnCode toAdsReturnCode() {
return AdsReturnCode.of(getAsLong());
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSNetId.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSNetId.java
index c22a7fd..87f5256 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSNetId.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSNetId.java
@@ -41,14 +41,14 @@ public class AMSNetId extends ByteValue {
public static final Pattern AMS_NET_ID_PATTERN =
Pattern.compile("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}");
- public static final int NUM_BYTES = 6;
+ private static final int NUM_BYTES = 6;
- AMSNetId(byte... values) {
+ private AMSNetId(byte... values) {
super(values);
assertLength(NUM_BYTES);
}
- public static AMSNetId of(byte... values) {
+ private static AMSNetId of(byte... values) {
return new AMSNetId(values);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSPort.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSPort.java
index 45ee7d5..fd7f775 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSPort.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSPort.java
@@ -28,9 +28,9 @@ public class AMSPort extends ByteValue {
public static final Pattern AMS_PORT_PATTERN = Pattern.compile("\\d+");
- public static final int NUM_BYTES = 2;
+ private static final int NUM_BYTES = 2;
- AMSPort(byte... value) {
+ private AMSPort(byte... value) {
super(value);
assertLength(NUM_BYTES);
}
@@ -61,6 +61,6 @@ public class AMSPort extends ByteValue {
@Override
public String toString() {
- return "" + (getBytes()[1] << 8 | getBytes()[0]);
+ return Integer.toString((getBytes()[1] << 8 | getBytes()[0]) & 0xff);
}
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Command.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Command.java
index d526795..1c78b74 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Command.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Command.java
@@ -44,7 +44,7 @@ public enum Command implements ByteReadable {
*/
UNKNOWN();
- public static final int NUM_BYTES = 2;
+ private static final int NUM_BYTES = 2;
final byte[] value;
@@ -91,7 +91,7 @@ public enum Command implements ByteReadable {
return UNKNOWN;
}
- public static Command of(int intValue) {
+ private static Command of(int intValue) {
// TODO: improve by using a map
for (Command command : values()) {
if (command.intValue == intValue) {
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/DataLength.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/DataLength.java
index e1d9e91..389e9eb 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/DataLength.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/DataLength.java
@@ -25,19 +25,19 @@ public class DataLength extends UnsignedIntLEByteValue {
public static final int NUM_BYTES = UnsignedIntLEByteValue.NUM_BYTES;
- protected DataLength(byte... values) {
+ private DataLength(byte... values) {
super(values);
}
- protected DataLength(long value) {
+ private DataLength(long value) {
super(value);
}
- protected DataLength(String length) {
+ private DataLength(String length) {
super(length);
}
- protected DataLength(ByteBuf byteBuf) {
+ private DataLength(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Invoke.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Invoke.java
index 8759731..baa4932 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Invoke.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Invoke.java
@@ -27,19 +27,19 @@ public class Invoke extends UnsignedIntLEByteValue {
public static final Invoke NONE = of(0);
- protected Invoke(byte... values) {
+ private Invoke(byte... values) {
super(values);
}
- protected Invoke(long value) {
+ private Invoke(long value) {
super(value);
}
- protected Invoke(ByteBuf byteBuf) {
+ private Invoke(ByteBuf byteBuf) {
super(byteBuf);
}
- public Invoke(String invokeId) {
+ private Invoke(String invokeId) {
super(invokeId);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Length.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Length.java
index 5f7fe3f..47a5052 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Length.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Length.java
@@ -27,19 +27,19 @@ public class Length extends UnsignedIntLEByteValue {
public static final Length NONE = of(0);
- protected Length(byte... values) {
+ private Length(byte... values) {
super(values);
}
- protected Length(long value) {
+ private Length(long value) {
super(value);
}
- protected Length(String length) {
+ private Length(String length) {
super(length);
}
- protected Length(ByteBuf byteBuf) {
+ private Length(ByteBuf byteBuf) {
super(byteBuf);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/State.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/State.java
index c81ce1d..027328f 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/State.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/State.java
@@ -68,11 +68,11 @@ public class State extends UnsignedShortLEByteValue {
return (value & this.mask) != 0;
}
- public boolean applies(State state) {
+ boolean applies(State state) {
return (state.getAsInt() & this.mask) != 0;
}
- public int getMask() {
+ int getMask() {
return mask;
}
@@ -86,21 +86,21 @@ public class State extends UnsignedShortLEByteValue {
public static final State DEFAULT_RESPONSE = State.of(ADS_COMMAND, RESPONSE);
- public static final int NUM_BYTES = UnsignedShortLEByteValue.NUM_BYTES;
+ private static final int NUM_BYTES = UnsignedShortLEByteValue.NUM_BYTES;
- protected State(byte... values) {
+ private State(byte... values) {
super(values);
}
- protected State(int value) {
+ private State(int value) {
super(value);
}
- protected State(String stateId) {
+ private State(String stateId) {
super(stateId);
}
- protected State(ByteBuf byteBuf) {
+ private State(ByteBuf byteBuf) {
super(byteBuf);
}
@@ -108,7 +108,7 @@ public class State extends UnsignedShortLEByteValue {
return new State(values);
}
- public static State of(int value) {
+ private static State of(int value) {
checkUnsignedBounds(value, NUM_BYTES);
return new State(value);
}
@@ -121,11 +121,11 @@ public class State extends UnsignedShortLEByteValue {
return new State(stateId);
}
- public static State of(StateMask... stateMasks) {
+ private static State of(StateMask... stateMasks) {
return State.of(Stream.of(stateMasks).map(StateMask::getMask).reduce(0, (a, b) -> a | b));
}
- public EnumSet<StateMask> getStateMaskEnumSet() {
+ private EnumSet<StateMask> getStateMaskEnumSet() {
List<StateMask> result = new LinkedList<>();
if (isResponse()) {
result.add(StateMask.RESPONSE);
@@ -157,7 +157,7 @@ public class State extends UnsignedShortLEByteValue {
return EnumSet.copyOf(result);
}
- public boolean isResponse() {
+ private boolean isResponse() {
return RESPONSE.applies(this);
}
@@ -165,35 +165,35 @@ public class State extends UnsignedShortLEByteValue {
return !isResponse();
}
- public boolean isNoReturn() {
+ private boolean isNoReturn() {
return NO_RETURN.applies(this);
}
- public boolean isADSCommand() {
+ private boolean isADSCommand() {
return ADS_COMMAND.applies(this);
}
- public boolean isSystemCommand() {
+ private boolean isSystemCommand() {
return SYSTEM_COMMAND.applies(this);
}
- public boolean isHighPriorityCommand() {
+ private boolean isHighPriorityCommand() {
return HIGH_PRIORITY_COMMAND.applies(this);
}
- public boolean isTimestampAdded() {
+ private boolean isTimestampAdded() {
return TIMESTAMP_ADDED.applies(this);
}
- public boolean isUDPCommand() {
+ private boolean isUDPCommand() {
return UDP_COMMAND.applies(this);
}
- public boolean isInitCommand() {
+ private boolean isInitCommand() {
return INIT_COMMAND.applies(this);
}
- public boolean isBroadcast() {
+ private boolean isBroadcast() {
return BROADCAST.applies(this);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/ByteValue.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/ByteValue.java
index db39e44..61ba37e 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/ByteValue.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/ByteValue.java
@@ -29,19 +29,19 @@ public class ByteValue implements ByteReadable {
protected final byte[] value;
- public ByteValue(byte... value) {
+ protected ByteValue(byte... value) {
Objects.requireNonNull(value);
this.value = value;
}
- public void assertLength(int length) {
+ protected void assertLength(int length) {
if (value.length != length) {
throw new IllegalArgumentException("Expected length " + length + " got " + value.length);
}
}
public static void checkUnsignedBounds(long value, int numberOfBytes) {
- double upperBound = Math.pow(2, 8 * numberOfBytes);
+ double upperBound = Math.pow((double) 2, (double) (8 * numberOfBytes));
if (value < 0 || value >= upperBound) {
throw new IllegalArgumentException("Value must between 0 and " + upperBound + ". Was " + value);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedIntLEByteValue.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedIntLEByteValue.java
index 7885a77..4ba9ace 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedIntLEByteValue.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedIntLEByteValue.java
@@ -26,29 +26,29 @@ public abstract class UnsignedIntLEByteValue extends ByteValue {
public static final int NUM_BYTES = 4;
- protected final long longValue;
+ private final long longValue;
- public UnsignedIntLEByteValue(byte... value) {
+ protected UnsignedIntLEByteValue(byte... value) {
super(value);
assertLength(NUM_BYTES);
longValue = getBytes()[3] << 24 | getBytes()[2] << 16 | getBytes()[1] << 8 | getBytes()[0];
}
- public UnsignedIntLEByteValue(long value) {
+ protected UnsignedIntLEByteValue(long value) {
super(ofLong(value));
checkUnsignedBounds(value, NUM_BYTES);
longValue = value;
}
- public UnsignedIntLEByteValue(String value) {
+ protected UnsignedIntLEByteValue(String value) {
this(Long.parseLong(value));
}
- public UnsignedIntLEByteValue(ByteBuf byteBuf) {
+ protected UnsignedIntLEByteValue(ByteBuf byteBuf) {
this(byteBuf.readUnsignedIntLE());
}
- protected static byte[] ofLong(long value) {
+ private static byte[] ofLong(long value) {
return ByteBuffer.allocate(NUM_BYTES)
// LE
.put((byte) (value & 0xff))
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedShortLEByteValue.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedShortLEByteValue.java
index dc54f63..d6b65bf 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedShortLEByteValue.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedShortLEByteValue.java
@@ -26,29 +26,29 @@ public abstract class UnsignedShortLEByteValue extends ByteValue {
public static final int NUM_BYTES = 2;
- protected final int intValue;
+ private final int intValue;
- public UnsignedShortLEByteValue(byte... value) {
+ protected UnsignedShortLEByteValue(byte... value) {
super(value);
assertLength(NUM_BYTES);
- intValue = getBytes()[1] << 8 | getBytes()[0];
+ intValue = (getBytes()[1] << 8 | getBytes()[0]) & 0xff;
}
- public UnsignedShortLEByteValue(int value) {
+ protected UnsignedShortLEByteValue(int value) {
super(ofInt(value));
checkUnsignedBounds(value, NUM_BYTES);
intValue = value;
}
- public UnsignedShortLEByteValue(String value) {
+ protected UnsignedShortLEByteValue(String value) {
this(Integer.parseInt(value));
}
- public UnsignedShortLEByteValue(ByteBuf byteBuf) {
+ protected UnsignedShortLEByteValue(ByteBuf byteBuf) {
this(byteBuf.readUnsignedShortLE());
}
- protected static byte[] ofInt(long value) {
+ private static byte[] ofInt(long value) {
return ByteBuffer.allocate(NUM_BYTES)
// LE
.put((byte) (value & 0xff))
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/ADSPlcConnection.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/ADSPlcConnection.java
index 9b52907..d25762a 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/ADSPlcConnection.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/ADSPlcConnection.java
@@ -40,7 +40,7 @@ import java.util.concurrent.CompletableFuture;
public class ADSPlcConnection extends AbstractPlcConnection implements PlcReader, PlcWriter {
- public static final int TCP_PORT = 48898;
+ private static final int TCP_PORT = 48898;
private final AMSNetId targetAmsNetId;
@@ -59,7 +59,7 @@ public class ADSPlcConnection extends AbstractPlcConnection implements PlcReader
}
- public ADSPlcConnection(InetAddress address, AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort) {
+ private ADSPlcConnection(InetAddress address, AMSNetId targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort sourceAmsPort) {
this(address, null, targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort);
}
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/model/ADSAddress.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/model/ADSAddress.java
index b6892e3..f41e0a8 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/model/ADSAddress.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/model/ADSAddress.java
@@ -31,7 +31,7 @@ public class ADSAddress implements Address {
private final long indexOffset;
- protected ADSAddress(long indexGroup, long indexOffset) {
+ private ADSAddress(long indexGroup, long indexOffset) {
ByteValue.checkUnsignedBounds(indexGroup, 4);
this.indexGroup = indexGroup;
ByteValue.checkUnsignedBounds(indexOffset, 4);
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/ADSProtocol.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/ADSProtocol.java
index a1a959c..8993751 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/ADSProtocol.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/ADSProtocol.java
@@ -41,7 +41,7 @@ public class ADSProtocol extends MessageToMessageCodec<ByteBuf, AMSTCPPacket> {
private static final Logger LOGGER = LoggerFactory.getLogger(ADSProtocol.class);
- private ConcurrentMap<Invoke, AMSTCPPacket> requests;
+ private final ConcurrentMap<Invoke, AMSTCPPacket> requests;
public ADSProtocol() {
this.requests = new ConcurrentHashMap<>();
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/Plc4XADSProtocol.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/Plc4XADSProtocol.java
index e979eaa..a8de70a 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/Plc4XADSProtocol.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/Plc4XADSProtocol.java
@@ -62,7 +62,7 @@ public class Plc4XADSProtocol extends MessageToMessageCodec<AMSTCPPacket, PlcReq
private static final AtomicLong correlationBuilder = new AtomicLong(1);
- private ConcurrentMap<Long, PlcRequestContainer<PlcRequest, PlcResponse>> requests;
+ private final ConcurrentMap<Long, PlcRequestContainer<PlcRequest, PlcResponse>> requests;
private final AMSNetId targetAmsNetId;
private final AMSPort targetAmsPort;
@@ -173,7 +173,7 @@ public class Plc4XADSProtocol extends MessageToMessageCodec<AMSTCPPacket, PlcReq
}
@SuppressWarnings("unchecked")
- private PlcResponse decodeWriteResponse(ADSWriteResponse responseMessage, PlcRequestContainer<PlcRequest, PlcResponse> requestContainer) throws PlcProtocolException {
+ private PlcResponse decodeWriteResponse(ADSWriteResponse responseMessage, PlcRequestContainer<PlcRequest, PlcResponse> requestContainer) {
PlcWriteRequest plcWriteRequest = (PlcWriteRequest) requestContainer.getRequest();
WriteRequestItem requestItem = plcWriteRequest.getRequestItems().get(0);
@@ -187,7 +187,7 @@ public class Plc4XADSProtocol extends MessageToMessageCodec<AMSTCPPacket, PlcReq
}
@SuppressWarnings("unchecked")
- private PlcResponse decodeReadResponse(ADSReadResponse responseMessage, PlcRequestContainer<PlcRequest, PlcResponse> requestContainer) throws PlcProtocolException {
+ private PlcResponse decodeReadResponse(ADSReadResponse responseMessage, PlcRequestContainer<PlcRequest, PlcResponse> requestContainer) {
PlcReadRequest plcReadRequest = (PlcReadRequest) requestContainer.getRequest();
ReadRequestItem requestItem = plcReadRequest.getRequestItems().get(0);
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/ADSDumper.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/ADSDumper.java
index f9881f0..485d0cb 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/ADSDumper.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/ADSDumper.java
@@ -46,7 +46,7 @@ public class ADSDumper {
private static final Logger logger = LoggerFactory.getLogger(ADSDumper.class);
- public static final void main(String... args) throws Exception {
+ public static void main(String... args) throws Exception {
Path dumpFile = Files.createTempFile("pcapdump", ".pcap");
try (PcapHandle handle = Pcaps.openDead(DataLinkType.EN10MB, 65536);
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/LengthTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/LengthTest.java
index bb25c22..7fe57c8 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/LengthTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/LengthTest.java
@@ -26,7 +26,7 @@ import static org.junit.Assert.assertEquals;
public class LengthTest {
- byte NULL_BYTE = 0x0;
+ private final byte NULL_BYTE = 0x0;
@Test
public void ofBytes() {
@@ -52,7 +52,7 @@ public class LengthTest {
assertEquals(Length.of("1").toString(), "1");
}
- void assertByte(Length actual, String expected) {
+ private void assertByte(Length actual, String expected) {
assertEquals(expected, "0x" + Hex.encodeHexString(actual.getBytes()));
}
}
\ No newline at end of file
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/ReadLengthTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/ReadLengthTest.java
index 1858713..34c2750 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/ReadLengthTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/ReadLengthTest.java
@@ -27,7 +27,7 @@ import static org.junit.Assert.assertEquals;
public class ReadLengthTest {
- byte NULL_BYTE = 0x0;
+ private final byte NULL_BYTE = 0x0;
@Test
public void ofBytes() {
@@ -53,7 +53,7 @@ public class ReadLengthTest {
assertEquals(ReadLength.of("1").toString(), "1");
}
- void assertByte(ReadLength actual, String expected) {
+ private void assertByte(ReadLength actual, String expected) {
assertEquals(expected, "0x" + Hex.encodeHexString(actual.getBytes()));
}
}
\ No newline at end of file
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/SampleSizeTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/SampleSizeTest.java
index 22a128f..1cc3839 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/SampleSizeTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/SampleSizeTest.java
@@ -26,7 +26,7 @@ import static org.junit.Assert.assertEquals;
public class SampleSizeTest {
- byte NULL_BYTE = 0x0;
+ private final byte NULL_BYTE = 0x0;
@Test
public void ofBytes() {
@@ -52,7 +52,7 @@ public class SampleSizeTest {
assertEquals(SampleSize.of("1").toString(), "1");
}
- void assertByte(SampleSize actual, String expected) {
+ private void assertByte(SampleSize actual, String expected) {
assertEquals(expected, "0x" + Hex.encodeHexString(actual.getBytes()));
}
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/SamplesTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/SamplesTest.java
index 1434ec7..5884d2b 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/SamplesTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/SamplesTest.java
@@ -26,7 +26,7 @@ import static org.junit.Assert.assertEquals;
public class SamplesTest {
- byte NULL_BYTE = 0x0;
+ private final byte NULL_BYTE = 0x0;
@Test
public void ofBytes() {
@@ -52,7 +52,7 @@ public class SamplesTest {
assertEquals(Samples.of("1").toString(), "1");
}
- void assertByte(Samples actual, String expected) {
+ private void assertByte(Samples actual, String expected) {
assertEquals(expected, "0x" + Hex.encodeHexString(actual.getBytes()));
}
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/WriteLengthTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/WriteLengthTest.java
index 087dc92..2e62b37 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/WriteLengthTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/WriteLengthTest.java
@@ -27,7 +27,7 @@ import static org.junit.Assert.assertEquals;
public class WriteLengthTest {
- byte NULL_BYTE = 0x0;
+ private final byte NULL_BYTE = 0x0;
@Test
public void ofBytes() {
@@ -53,7 +53,7 @@ public class WriteLengthTest {
assertEquals(WriteLength.of("1").toString(), "1");
}
- void assertByte(WriteLength actual, String expected) {
+ private void assertByte(WriteLength actual, String expected) {
assertEquals(expected, "0x" + Hex.encodeHexString(actual.getBytes()));
}
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSPortTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSPortTest.java
index 12ee66b..7d1876f 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSPortTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSPortTest.java
@@ -27,7 +27,7 @@ import static org.junit.Assert.assertEquals;
public class AMSPortTest {
- byte NULL_BYTE = 0x0;
+ private final byte NULL_BYTE = 0x0;
@Test
public void ofBytes() {
@@ -53,7 +53,7 @@ public class AMSPortTest {
assertEquals(AMSPort.of("1").toString(), "1");
}
- void assertByte(AMSPort actual, String expected) {
+ private void assertByte(AMSPort actual, String expected) {
assertEquals(expected, "0x" + Hex.encodeHexString(actual.getBytes()));
}
}
\ No newline at end of file
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/DataLengthTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/DataLengthTest.java
index fd5e6d0..a867031 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/DataLengthTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/DataLengthTest.java
@@ -27,7 +27,7 @@ import static org.junit.Assert.assertEquals;
public class DataLengthTest {
- byte NULL_BYTE = 0x0;
+ private final byte NULL_BYTE = 0x0;
@Test
public void ofBytes() {
@@ -53,7 +53,7 @@ public class DataLengthTest {
assertEquals(DataLength.of("1").toString(), "1");
}
- void assertByte(DataLength actual, String expected) {
+ private void assertByte(DataLength actual, String expected) {
assertEquals(expected, "0x" + Hex.encodeHexString(actual.getBytes()));
}
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/LengthTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/LengthTest.java
index 5648e18..3f9ded4 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/LengthTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/LengthTest.java
@@ -27,7 +27,7 @@ import static org.junit.Assert.assertEquals;
public class LengthTest {
- byte NULL_BYTE = 0x0;
+ private final byte NULL_BYTE = 0x0;
@Test
public void ofBytes() {
@@ -53,7 +53,7 @@ public class LengthTest {
assertEquals(Length.of("1").toString(), "1");
}
- void assertByte(Length actual, String expected) {
+ private void assertByte(Length actual, String expected) {
assertEquals(expected, "0x" + Hex.encodeHexString(actual.getBytes()));
}
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/netty/Plc4XADSProtocolTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/netty/Plc4XADSProtocolTest.java
index 9a926dc..b044801 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/netty/Plc4XADSProtocolTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/netty/Plc4XADSProtocolTest.java
@@ -46,7 +46,7 @@ public class Plc4XADSProtocolTest {
private Plc4XADSProtocol SUT;
- @Parameterized.Parameter(0)
+ @Parameterized.Parameter()
public PlcRequestContainer<PlcRequest, PlcResponse> plcRequestContainer;
@Parameterized.Parameter(1)
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/util/TcpHexDumper.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/util/TcpHexDumper.java
index 5ab17e7..926047b 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/util/TcpHexDumper.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/util/TcpHexDumper.java
@@ -38,7 +38,7 @@ public class TcpHexDumper extends ExternalResource implements Closeable {
private static final Logger logger = LoggerFactory.getLogger(TcpHexDumper.class);
- private ExecutorService pool;
+ private final ExecutorService pool;
private final Integer portToUse;
@@ -46,7 +46,7 @@ public class TcpHexDumper extends ExternalResource implements Closeable {
private ServerSocket serverSocket;
- public TcpHexDumper(Integer portToUse) {
+ private TcpHexDumper(Integer portToUse) {
this(portToUse, 10);
}
@@ -56,7 +56,7 @@ public class TcpHexDumper extends ExternalResource implements Closeable {
this.shutdownTimeout = shutdownTimeout;
}
- public void init(int port) throws IOException, InterruptedException {
+ private void init(int port) throws IOException, InterruptedException {
if (serverSocket != null) {
stop(true);
}
@@ -94,11 +94,11 @@ public class TcpHexDumper extends ExternalResource implements Closeable {
logger.info("Started pool");
}
- public void stop() throws IOException, InterruptedException {
+ private void stop() throws IOException, InterruptedException {
stop(false);
}
- public void stop(boolean await) throws IOException, InterruptedException {
+ private void stop(boolean await) throws IOException, InterruptedException {
serverSocket.close();
if (await) {
pool.awaitTermination(shutdownTimeout, TimeUnit.SECONDS);
--
To stop receiving notification emails like this one, please contact
sruehl@apache.org.