[New] Added StrolchElementToJsonVisitor.withoutValueChanges()

This commit is contained in:
Robert von Burg 2021-06-07 17:08:39 +02:00
parent ef230cf040
commit 80d8bcadb6
2 changed files with 17 additions and 2 deletions

View File

@ -52,6 +52,7 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
private boolean withoutVersion;
private boolean withoutPolicies;
private boolean withoutStateVariables;
private boolean withoutValueChanges;
private int activityDepth = Integer.MAX_VALUE;
public StrolchElementToJsonVisitor() {
@ -94,6 +95,10 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
return this.withoutStateVariables;
}
public boolean isWithoutValueChanges() {
return this.withoutValueChanges;
}
public StrolchElementToJsonVisitor withLocator() {
this.withLocator = true;
return this;
@ -129,6 +134,11 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
return this;
}
public StrolchElementToJsonVisitor withoutValueChanges() {
this.withoutValueChanges = true;
return this;
}
public StrolchElementToJsonVisitor withoutStateVariables() {
this.withoutStateVariables = true;
return this;
@ -496,8 +506,8 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
this.actionHook.accept(element, rootJ);
// value changes
Iterator<IValueChange<? extends IValue<?>>> iter = element.getChanges().iterator();
if (iter.hasNext()) {
if (!this.withoutValueChanges && element.hasChanges()) {
Iterator<IValueChange<? extends IValue<?>>> iter = element.getChanges().iterator();
JsonArray changesJ = new JsonArray();
rootJ.add(Json.VALUE_CHANGES, changesJ);

View File

@ -94,6 +94,11 @@ public class StrolchRootElementToJsonVisitor implements StrolchRootElementVisito
return this;
}
public StrolchRootElementToJsonVisitor withoutValueChanges() {
this.visitor.withoutValueChanges();
return this;
}
public StrolchRootElementToJsonVisitor withPolicies() {
this.visitor.withPolicies();
return this;