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

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

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

import java.net.URI;

/**
 * The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented
 * in editing or documentation generation tools for convenience.
 */
public class InfoObjectBuilder {
    private String title = "API Documentation";
    private String description;
    private URI termsOfService;
    private ContactObject contact;
    private LicenseObject license;
    private String version = "1.0";

    /**
     * @param title REQUIRED. The title of the application. Default value is API Documentation
     * @return The current builder
     */
    public InfoObjectBuilder withTitle(String title) {
        this.title = title;
        return this;
    }

    /**
     * @param description A short description of the application. CommonMark syntax
     *                    MAY be used for rich text representation.
     * @return The current builder
     */
    public InfoObjectBuilder withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * @param termsOfService A URL to the Terms of Service for the API.
     * @return The current builder
     */
    public InfoObjectBuilder withTermsOfService(URI termsOfService) {
        this.termsOfService = termsOfService;
        return this;
    }

    /**
     * @param contact The contact information for the exposed API.
     * @return The current builder
     */
    public InfoObjectBuilder withContact(ContactObject contact) {
        this.contact = contact;
        return this;
    }

    /**
     * @param license The license information for the exposed API.
     * @return The current builder
     */
    public InfoObjectBuilder withLicense(LicenseObject license) {
        this.license = license;
        return this;
    }

    /**
     * @param version REQUIRED. The version of the OpenAPI document. Default value is 1.0
     * @return The current builder
     */
    public InfoObjectBuilder withVersion(String version) {
        this.version = version;
        return this;
    }

    public InfoObject build() {
        return new InfoObject(title, description, termsOfService, contact, license, version);
    }

    /**
     * Creates a builder for a {@link InfoObject}
     *
     * @return A new builder
     */
    public static InfoObjectBuilder infoObject() {
        return new InfoObjectBuilder();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy