io.muserver.openapi.ResponseObject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mu-server Show documentation
Show all versions of mu-server Show documentation
A simple but powerful web server framework
package io.muserver.openapi;
import java.io.IOException;
import java.io.Writer;
import java.util.Map;
import static io.muserver.Mutils.notNull;
import static io.muserver.openapi.Jsonizer.append;
/**
* @see ResponseObjectBuilder
*/
public class ResponseObject implements JsonWriter {
public final String description;
public final Map headers;
public final Map content;
public final Map links;
ResponseObject(String description, Map headers, Map content, Map links) {
notNull("description", description);
this.description = description;
this.headers = headers;
this.content = content;
this.links = links;
}
@Override
public void writeJson(Writer writer) throws IOException {
writer.write('{');
boolean isFirst = true;
isFirst = append(writer, "description", description, isFirst);
isFirst = append(writer, "headers", headers, isFirst);
isFirst = append(writer, "content", content, isFirst);
isFirst = append(writer, "links", links, isFirst);
writer.write('}');
}
}