net.sourceforge.plantuml.picoweb.RenderRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml Show documentation
Show all versions of plantuml Show documentation
PlantUML is a component that allows to quickly write :
* sequence diagram,
* use case diagram,
* class diagram,
* activity diagram,
* component diagram,
* state diagram
* object diagram
package net.sourceforge.plantuml.picoweb;
import net.sourceforge.plantuml.json.Json;
import net.sourceforge.plantuml.json.JsonArray;
import net.sourceforge.plantuml.json.JsonObject;
/**
* POJO of the json sent to "POST /render"
*/
public class RenderRequest {
private final String[] options;
private final String source;
public RenderRequest(String[] options, String source) {
this.options = options;
this.source = source;
}
public String[] getOptions() {
return options;
}
public String getSource() {
return source;
}
public static RenderRequest fromJson(String json) {
final JsonObject parsed = Json.parse(json).asObject();
final String[] options;
if (parsed.contains("options")) {
final JsonArray jsonArray = parsed.get("options").asArray();
options = new String[jsonArray.size()];
for (int i = 0; i < jsonArray.size(); i++) {
options[i] = jsonArray.get(i).asString();
}
} else {
options = new String[0];
}
return new RenderRequest(options, parsed.get("source").asString());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy