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

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

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

import java.util.List;

/**
 * An object representing a Server Variable for server URL template substitution.
 */
public class ServerVariableObjectBuilder {
    private List enumValues;
    private String defaultValue;
    private String description;

    /**
     * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
     * @return The current builder
     */
    public ServerVariableObjectBuilder withEnumValues(List enumValues) {
        this.enumValues = enumValues;
        return this;
    }

    /**
     * @param defaultValue REQUIRED. The default value to use for substitution, and to send, if an alternate value is not supplied. Unlike the
     * Schema Object's default, this value MUST be provided by the consumer.
     * @return The current builder
     */
    public ServerVariableObjectBuilder withDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
        return this;
    }

    /**
     * @param description An optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
     * @return The current builder
     */
    public ServerVariableObjectBuilder withDescription(String description) {
        this.description = description;
        return this;
    }

    public ServerVariableObject build() {
        return new ServerVariableObject(enumValues, defaultValue, description);
    }

    /**
     * Creates a builder for a {@link ServerVariableObjectBuilder}
     * @return A new builder
     */
    public static ServerVariableObjectBuilder serverVariableObject() {
        return new ServerVariableObjectBuilder();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy