plc4x-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [plc4x] hutcheb commented on a change in pull request #192: Refactor Field Handler Classes
Date Tue, 06 Oct 2020 09:35:52 GMT

hutcheb commented on a change in pull request #192:
URL: https://github.com/apache/plc4x/pull/192#discussion_r500139132



##########
File path: plc4j/api/src/main/java/org/apache/plc4x/java/api/value/PlcBYTE.java
##########
@@ -169,6 +169,30 @@ public PlcBYTE(@JsonProperty("value") short value) {
         }
     }
 
+    @Override
+    @JsonIgnore
+    public boolean isBoolean() {
+        return true;
+    }
+
+    @Override
+    @JsonIgnore
+    public boolean getBoolean() {
+        return (value != null) && !value.equals(0);
+    }

Review comment:
       I was having trouble with how we would do this. I was initially thinking that if we
request to read a WORD we should parse the return value as a PlcList of PlcBOOLs instead of
a PlcWORD but wasn't sure how to implement this easily.
   
   But your idea of returning a list from a getBoolean method seems reasonable.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message