From 5c9666af11dc5a4b48a8f2a37293080726d7673c Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Thu, 24 Oct 2019 20:47:57 +0200 Subject: [PATCH] [Fix] assert hook is not yet set in StrolchElementToJsonVisitor --- .../strolch/model/json/StrolchElementToJsonVisitor.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/li.strolch.model/src/main/java/li/strolch/model/json/StrolchElementToJsonVisitor.java b/li.strolch.model/src/main/java/li/strolch/model/json/StrolchElementToJsonVisitor.java index de25ef978..527b8447f 100644 --- a/li.strolch.model/src/main/java/li/strolch/model/json/StrolchElementToJsonVisitor.java +++ b/li.strolch.model/src/main/java/li/strolch/model/json/StrolchElementToJsonVisitor.java @@ -28,6 +28,7 @@ import li.strolch.model.timevalue.IValue; import li.strolch.model.timevalue.IValueChange; import li.strolch.model.visitor.StrolchElementVisitor; import li.strolch.utils.collections.MapOfSets; +import li.strolch.utils.dbc.DBC; import li.strolch.utils.iso8601.ISO8601FormatFactory; public class StrolchElementToJsonVisitor implements StrolchElementVisitor { @@ -171,21 +172,29 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor hook) { + DBC.PRE.assertNotNull("hook must not be null", hook); + DBC.PRE.assertNull("resourceHook already set!", this.resourceHook); this.resourceHook = hook; return this; } public StrolchElementToJsonVisitor orderHook(BiConsumer hook) { + DBC.PRE.assertNotNull("hook must not be null", hook); + DBC.PRE.assertNull("orderHook already set!", this.orderHook); this.orderHook = hook; return this; } public StrolchElementToJsonVisitor activityHook(BiConsumer hook) { + DBC.PRE.assertNotNull("hook must not be null", hook); + DBC.PRE.assertNull("activityHook already set!", this.activityHook); this.activityHook = hook; return this; } public StrolchElementToJsonVisitor actionHook(BiConsumer hook) { + DBC.PRE.assertNotNull("hook must not be null", hook); + DBC.PRE.assertNull("actionHook already set!", this.actionHook); this.actionHook = hook; return this; }