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 2022/05/13 15:19:46 UTC

[plc4x-build-tools] branch develop updated: feat(codegen): changed validation to fail parsing conditionally

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

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x-build-tools.git


The following commit(s) were added to refs/heads/develop by this push:
     new 12c6aa9  feat(codegen): changed validation to fail parsing conditionally
12c6aa9 is described below

commit 12c6aa9eda06ddda855737f7a82e37f38dd8bfc9
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri May 13 17:19:10 2022 +0200

    feat(codegen): changed validation to fail parsing conditionally
    
    + added option to switch between failing and non failing behavior
---
 .../codegenerator/types/fields/ValidationField.java        | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/code-generation/types-base/src/main/java/org/apache/plc4x/plugins/codegenerator/types/fields/ValidationField.java b/code-generation/types-base/src/main/java/org/apache/plc4x/plugins/codegenerator/types/fields/ValidationField.java
index 5062ff4..831d5e2 100644
--- a/code-generation/types-base/src/main/java/org/apache/plc4x/plugins/codegenerator/types/fields/ValidationField.java
+++ b/code-generation/types-base/src/main/java/org/apache/plc4x/plugins/codegenerator/types/fields/ValidationField.java
@@ -22,9 +22,23 @@ import org.apache.plc4x.plugins.codegenerator.types.terms.Term;
 
 import java.util.Optional;
 
+/**
+ * Can be used to validate/assert state during parsing/serializing
+ */
 public interface ValidationField extends FieldConversions {
 
+    /**
+     * @return the expression that should evaluate to true to let the validation pass
+     */
     Term getValidationExpression();
 
+    /**
+     * @return the human-readable description of this validation
+     */
     Optional<String> getDescription();
+
+    /**
+     * @return true if this is an unrecoverable error (e.g non-assert)
+     */
+    boolean shouldFail();
 }