[New] Added StrolchElementToJsonVisitor.withoutObjectType()
This commit is contained in:
parent
844bddeefc
commit
15e8b85126
|
@ -49,6 +49,7 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
|||
private Set<String> flatBags;
|
||||
private Set<String> flatBagsByType;
|
||||
private boolean withoutElementName;
|
||||
private boolean withoutObjectType;
|
||||
private boolean withLocator;
|
||||
private boolean withoutVersion;
|
||||
private boolean withoutPolicies;
|
||||
|
@ -120,6 +121,11 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
|||
return this;
|
||||
}
|
||||
|
||||
public StrolchElementToJsonVisitor withoutObjectType() {
|
||||
this.withoutObjectType = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public StrolchElementToJsonVisitor withElementName() {
|
||||
this.withoutElementName = false;
|
||||
return this;
|
||||
|
@ -398,6 +404,7 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
|||
protected JsonObject toJson(Resource element) {
|
||||
|
||||
JsonObject rootJ = new JsonObject();
|
||||
if (!this.withoutObjectType)
|
||||
rootJ.addProperty(OBJECT_TYPE, RESOURCE);
|
||||
|
||||
toJson(element, rootJ);
|
||||
|
@ -416,6 +423,7 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
|||
protected JsonObject toJson(Order element) {
|
||||
|
||||
JsonObject rootJ = new JsonObject();
|
||||
if (!this.withoutObjectType)
|
||||
rootJ.addProperty(OBJECT_TYPE, ORDER);
|
||||
|
||||
toJson(element, rootJ);
|
||||
|
@ -444,6 +452,7 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
|||
|
||||
protected JsonObject toJson(Activity element, JsonObject rootJ, int currentDepth) {
|
||||
|
||||
if (!this.withoutObjectType)
|
||||
rootJ.addProperty(OBJECT_TYPE, ACTIVITY);
|
||||
|
||||
toJson((AbstractStrolchElement) element, rootJ);
|
||||
|
@ -490,6 +499,7 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
|||
|
||||
protected JsonObject toJson(Action element, JsonObject rootJ) {
|
||||
|
||||
if (!this.withoutObjectType)
|
||||
rootJ.addProperty(OBJECT_TYPE, ACTION);
|
||||
|
||||
// attributes
|
||||
|
|
|
@ -74,6 +74,11 @@ public class StrolchRootElementToJsonVisitor implements StrolchRootElementVisito
|
|||
return this;
|
||||
}
|
||||
|
||||
public StrolchRootElementToJsonVisitor withoutObjectType() {
|
||||
this.visitor.withoutObjectType();
|
||||
return this;
|
||||
}
|
||||
|
||||
public StrolchRootElementToJsonVisitor withElementName() {
|
||||
this.visitor.withElementName();
|
||||
return this;
|
||||
|
|
Loading…
Reference in New Issue