fdupont-epsilia commented on issue #1626:
URL: https://github.com/apache/plc4x/issues/1626#issuecomment-2476375531

   It is a work in progress. What I have done is to load types from a json 
file. I don't know if this approach would make the cut into plc4x.
   Beside base data type, string and array of all size are missing. Only 
solution is to add them manually.
   
   ``` java
   if (new java.io.File(configuration.getdataTypeTableJSONFile()).exists())
   {
        try {
                java.io.Reader reader = new 
java.io.FileReader(configuration.getdataTypeTableJSONFile());
                com.google.gson.Gson gson = new com.google.gson.Gson();
                java.lang.reflect.Type dataTypeTableType = new 
com.google.gson.reflect.TypeToken<Map<String, AdsDataTypeTableEntry>>() 
{}.getType();
                Map<String, AdsDataTypeTableEntry> dataTypeFromJson = 
gson.fromJson(reader, dataTypeTableType);
   
                for (Map.Entry<String, AdsDataTypeTableEntry> entry : 
dataTypeFromJson.entrySet()) {
                        String key = entry.getKey();
                        AdsDataTypeTableEntry value = entry.getValue();
                        if (!dataTypeTable.containsKey(key)) {
                                dataTypeTable.put(key, value);
                        }
                }
        }
        catch (java.io.FileNotFoundException e) {
                LOGGER.debug("Error reading json file of data types: {}", 
configuration.getdataTypeTableJSONFile(), e);
        }
   }
   `` `
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to