Class ResponseObjectBuilder


  • public class ResponseObjectBuilder
    extends java.lang.Object

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

    • Constructor Detail

      • ResponseObjectBuilder

        public ResponseObjectBuilder()
    • Method Detail

      • withDescription

        public ResponseObjectBuilder withDescription​(java.lang.String description)
        Parameters:
        description - REQUIRED. A short description of the response. CommonMark syntax MAY be used for rich text representation.
        Returns:
        The current builder
      • withHeaders

        public ResponseObjectBuilder withHeaders​(java.util.Map<java.lang.String,​HeaderObject> headers)
        Parameters:
        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.
        Returns:
        The current builder
      • withContent

        public ResponseObjectBuilder withContent​(java.util.Map<java.lang.String,​MediaTypeObject> content)
        Parameters:
        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/*
        Returns:
        The current builder
      • withLinks

        public ResponseObjectBuilder withLinks​(java.util.Map<java.lang.String,​LinkObject> links)
        Parameters:
        links - A map of operations links that can be followed from the response.
        Returns:
        The current builder
      • mergeResponses

        public static ResponseObjectBuilder mergeResponses​(ResponseObject primary,
                                                           ResponseObject secondary)
        Creates a new build by merging two existing response objects
        Parameters:
        primary - A responses object to use. This is the dominant response who's values will be preferred when values cannot be merged (such as ResponseObject.description
        secondary - The other responses object
        Returns:
        A builder that is the merged value of the two given ones