From fd9290fc09c9c40a25a98b9cde42217d6dd2e8fa Mon Sep 17 00:00:00 2001 From: rschoene <rene.schoene@tu-dresden.de> Date: Wed, 5 May 2021 18:21:21 +0200 Subject: [PATCH] add untested way to reject (i.e., discard) a value to be send --- .../src/main/resources/mappingApplication.mustache | 3 +++ ragconnect.base/src/main/resources/ragconnect.mustache | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/ragconnect.base/src/main/resources/mappingApplication.mustache b/ragconnect.base/src/main/resources/mappingApplication.mustache index 064004b..47ec31e 100644 --- a/ragconnect.base/src/main/resources/mappingApplication.mustache +++ b/ragconnect.base/src/main/resources/mappingApplication.mustache @@ -3,6 +3,9 @@ try { {{#InnerMappingDefinitions}} {{^last}}{{toType}} {{/last}}{{outputVarName}} = {{methodName}}({{inputVarName}}); {{/InnerMappingDefinitions}} +} catch (RagConnectRejectMappingException e) { + // do not print message in case of rejection + {{preemptiveReturn}} } catch (Exception e) { e.printStackTrace(); {{preemptiveReturn}} diff --git a/ragconnect.base/src/main/resources/ragconnect.mustache b/ragconnect.base/src/main/resources/ragconnect.mustache index 35db18c..b834bd9 100644 --- a/ragconnect.base/src/main/resources/ragconnect.mustache +++ b/ragconnect.base/src/main/resources/ragconnect.mustache @@ -17,6 +17,11 @@ aspect RagConnect { {{> sendDefinition}} {{/TypeSendDefinitions}} + class RagConnectRejectMappingException extends RuntimeException {} + private static void ASTNode.reject() { + throw new RagConnectRejectMappingException(); + } + {{#MappingDefinitions}} {{#isUsed}} {{> mappingDefinition}} -- GitLab