[Fix] assert hook is not yet set in StrolchElementToJsonVisitor
This commit is contained in:
parent
54fb6245ae
commit
5c9666af11
|
@ -28,6 +28,7 @@ import li.strolch.model.timevalue.IValue;
|
||||||
import li.strolch.model.timevalue.IValueChange;
|
import li.strolch.model.timevalue.IValueChange;
|
||||||
import li.strolch.model.visitor.StrolchElementVisitor;
|
import li.strolch.model.visitor.StrolchElementVisitor;
|
||||||
import li.strolch.utils.collections.MapOfSets;
|
import li.strolch.utils.collections.MapOfSets;
|
||||||
|
import li.strolch.utils.dbc.DBC;
|
||||||
import li.strolch.utils.iso8601.ISO8601FormatFactory;
|
import li.strolch.utils.iso8601.ISO8601FormatFactory;
|
||||||
|
|
||||||
public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonElement> {
|
public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonElement> {
|
||||||
|
@ -171,21 +172,29 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
||||||
}
|
}
|
||||||
|
|
||||||
public StrolchElementToJsonVisitor resourceHook(BiConsumer<Resource, JsonObject> hook) {
|
public StrolchElementToJsonVisitor resourceHook(BiConsumer<Resource, JsonObject> hook) {
|
||||||
|
DBC.PRE.assertNotNull("hook must not be null", hook);
|
||||||
|
DBC.PRE.assertNull("resourceHook already set!", this.resourceHook);
|
||||||
this.resourceHook = hook;
|
this.resourceHook = hook;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StrolchElementToJsonVisitor orderHook(BiConsumer<Order, JsonObject> hook) {
|
public StrolchElementToJsonVisitor orderHook(BiConsumer<Order, JsonObject> hook) {
|
||||||
|
DBC.PRE.assertNotNull("hook must not be null", hook);
|
||||||
|
DBC.PRE.assertNull("orderHook already set!", this.orderHook);
|
||||||
this.orderHook = hook;
|
this.orderHook = hook;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StrolchElementToJsonVisitor activityHook(BiConsumer<Activity, JsonObject> hook) {
|
public StrolchElementToJsonVisitor activityHook(BiConsumer<Activity, JsonObject> hook) {
|
||||||
|
DBC.PRE.assertNotNull("hook must not be null", hook);
|
||||||
|
DBC.PRE.assertNull("activityHook already set!", this.activityHook);
|
||||||
this.activityHook = hook;
|
this.activityHook = hook;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StrolchElementToJsonVisitor actionHook(BiConsumer<Action, JsonObject> hook) {
|
public StrolchElementToJsonVisitor actionHook(BiConsumer<Action, JsonObject> hook) {
|
||||||
|
DBC.PRE.assertNotNull("hook must not be null", hook);
|
||||||
|
DBC.PRE.assertNull("actionHook already set!", this.actionHook);
|
||||||
this.actionHook = hook;
|
this.actionHook = hook;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue