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

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

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

import java.util.Map;

/**
 * An object representing a Server.
 */
public class ServerObjectBuilder {
    private String url;
    private String description;
    private Map variables;

    /**
     * @param url REQUIRED. A URL to the target host.  This URL supports Server Variables and MAY be relative, to indicate
     * that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will
     * be made when a variable is named in {brackets}.
     * @return The current builder
     */
    public ServerObjectBuilder withUrl(String url) {
        this.url = url;
        return this;
    }

    /**
     * @param description An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation.
     * @return The current builder
     */
    public ServerObjectBuilder withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
     * @return The current builder
     */
    public ServerObjectBuilder withVariables(Map variables) {
        this.variables = variables;
        return this;
    }

    public ServerObject build() {
        return new ServerObject(url, description, variables);
    }

    /**
     * Creates a builder for a {@link ServerObject}
     *
     * @return A new builder
     */
    public static ServerObjectBuilder serverObject() {
        return new ServerObjectBuilder();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy