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

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

The newest version!
package io.muserver.openapi;

import java.io.IOException;
import java.io.Writer;
import java.util.Map;

import static io.muserver.openapi.Jsonizer.append;

/**
 * @see LinkObjectBuilder
 */
public class LinkObject implements JsonWriter {

    private final String operationId;
    private final Map parameters;
    private final Object requestBody;
    private final String description;
    private final ServerObject server;

    LinkObject(String operationId, Map parameters, Object requestBody, String description, ServerObject server) {
        this.operationId = operationId;
        this.parameters = parameters;
        this.requestBody = requestBody;
        this.description = description;
        this.server = server;
    }

    @Override
    public void writeJson(Writer writer) throws IOException {
        writer.write('{');
        boolean isFirst = true;
        isFirst = append(writer, "operationId", operationId, isFirst);
        isFirst = append(writer, "parameters", parameters, isFirst);
        isFirst = append(writer, "requestBody", requestBody, isFirst);
        isFirst = append(writer, "description", description, isFirst);
        isFirst = append(writer, "server", server, isFirst);
        writer.write('}');
    }

    /**
     * @return the value described by {@link LinkObjectBuilder#withOperationId}
     */
    public String operationId() {
        return operationId;
    }

    /**
      @return the value described by {@link LinkObjectBuilder#withParameters}
     */
    public Map parameters() {
        return parameters;
    }

    /**
      @return the value described by {@link LinkObjectBuilder#withRequestBody}
     */
    public Object requestBody() {
        return requestBody;
    }

    /**
      @return the value described by {@link LinkObjectBuilder#withDescription}
     */
    public String description() {
        return description;
    }

    /**
      @return the value described by {@link LinkObjectBuilder#withServer}
     */
    public ServerObject server() {
        return server;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy