You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by ld...@apache.org on 2022/04/19 22:28:00 UTC

[plc4x] 01/03: feat(codegen/plc4j): Add support for returning String output directly from DataIO.

This is an automated email from the ASF dual-hosted git repository.

ldywicki pushed a commit to branch feature/modbus-plus
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit c074ba3807ba6b2ec3341ab10d8d61c4caa9ee90
Author: Łukasz Dywicki <lu...@code-house.org>
AuthorDate: Tue Apr 19 17:29:52 2022 +0200

    feat(codegen/plc4j): Add support for returning String output directly from DataIO.
    
    Signed-off-by: Łukasz Dywicki <lu...@code-house.org>
---
 .../src/main/resources/templates/java/data-io-template.java.ftlh     | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/code-generation/language-java/src/main/resources/templates/java/data-io-template.java.ftlh b/code-generation/language-java/src/main/resources/templates/java/data-io-template.java.ftlh
index 7780429eb7..6c505cccb1 100644
--- a/code-generation/language-java/src/main/resources/templates/java/data-io-template.java.ftlh
+++ b/code-generation/language-java/src/main/resources/templates/java/data-io-template.java.ftlh
@@ -317,9 +317,14 @@ public class ${type.name} {
             return new PlcStruct(_map);
                     <#break>
                     <#case "List">
+                    <#if helper.getNonPrimitiveLanguageTypeNameForField(simpleField) == 'String'>
+            return new PlcSTRING(value);
+                    <#else>
             return new PlcList(value);
+                    </#if>
                     <#break>
                     <#default>
+                    // default ${case.name}
             return new Plc${case.name}(value);
                 </#switch>
             </#if>