All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.muserver.openapi.ResponseObjectBuilder Maven / Gradle / Ivy

There is a newer version: 2.0.3
Show newest version
package io.muserver.openapi;

import java.util.Map;

/**
 * 

Describes a single response from an API Operation, including design-time, static links to operations * based on the response.

*/ public class ResponseObjectBuilder { private String description; private Map headers; private Map content; private Map links; /** * @param description REQUIRED. A short description of the response. * CommonMark syntax MAY be used for rich text representation. * @return The current builder */ public ResponseObjectBuilder withDescription(String description) { this.description = description; return this; } /** * @param headers Maps a header name to its definition. RFC7230 * states header names are case insensitive. If a response header is defined with the name * "Content-Type", it SHALL be ignored. * @return The current builder */ public ResponseObjectBuilder withHeaders(Map headers) { this.headers = headers; return this; } /** * @param content A map containing descriptions of potential response payloads. The key is a media type or * media type range and the value * describes it. For responses that match multiple keys, only the most specific key is applicable. * e.g. text/plain overrides text/* * @return The current builder */ public ResponseObjectBuilder withContent(Map content) { this.content = content; return this; } /** * @param links A map of operations links that can be followed from the response. * @return The current builder */ public ResponseObjectBuilder withLinks(Map links) { this.links = links; return this; } public ResponseObject build() { return new ResponseObject(description, headers, content, links); } /** * Creates a builder for a {@link ResponseObject} * * @return A new builder */ public static ResponseObjectBuilder responseObject() { return new ResponseObjectBuilder(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy