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

com.linkedin.restli.common.multiplexer.MultiplexedResponseContent Maven / Gradle / Ivy

Go to download

Pegasus is a framework for building robust, scalable service architectures using dynamic discovery and simple asychronous type-checked REST + JSON APIs.

There is a newer version: 27.7.18
Show newest version

package com.linkedin.restli.common.multiplexer;

import java.util.List;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import com.linkedin.data.DataMap;
import com.linkedin.data.schema.PathSpec;
import com.linkedin.data.schema.RecordDataSchema;
import com.linkedin.data.template.DataTemplateUtil;
import com.linkedin.data.template.GetMode;
import com.linkedin.data.template.RecordTemplate;
import com.linkedin.data.template.SetMode;


/**
 * Represents multiple HTTP responses to send as a single multiplexed HTTP response
 * 
 */
@Generated(value = "com.linkedin.pegasus.generator.JavaCodeUtil", comments = "Rest.li Data Template. Generated from /Users/mnchen/dev/pegasus_trunk/pegasus/restli-common/src/main/pegasus/com/linkedin/restli/common/multiplexer/MultiplexedResponseContent.pdsc.", date = "Tue Oct 03 15:15:24 PDT 2017")
public class MultiplexedResponseContent
    extends RecordTemplate
{

    private final static MultiplexedResponseContent.Fields _fields = new MultiplexedResponseContent.Fields();
    private final static RecordDataSchema SCHEMA = ((RecordDataSchema) DataTemplateUtil.parseSchema("{\"type\":\"record\",\"name\":\"MultiplexedResponseContent\",\"namespace\":\"com.linkedin.restli.common.multiplexer\",\"doc\":\"Represents multiple HTTP responses to send as a single multiplexed HTTP response\",\"fields\":[{\"name\":\"responses\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"IndividualResponse\",\"doc\":\"Individual HTTP response within a multiplexed response\",\"fields\":[{\"name\":\"status\",\"type\":\"int\",\"doc\":\"HTTP status code\"},{\"name\":\"headers\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"doc\":\"HTTP headers\",\"default\":{}},{\"name\":\"body\",\"type\":{\"type\":\"record\",\"name\":\"IndividualBody\",\"doc\":\"Represents content that may be in the body of an individual request / response\",\"fields\":[]},\"doc\":\"Response body\",\"optional\":true}]}},\"doc\":\"Individual HTTP responses, where the key is Id of the corresponding individual request.\"}]}"));
    private final static RecordDataSchema.Field FIELD_Responses = SCHEMA.getField("responses");

    public MultiplexedResponseContent() {
        super(new DataMap(), SCHEMA);
    }

    public MultiplexedResponseContent(DataMap data) {
        super(data, SCHEMA);
    }

    public static MultiplexedResponseContent.Fields fields() {
        return _fields;
    }

    /**
     * Existence checker for responses
     * 
     * @see MultiplexedResponseContent.Fields#responses
     */
    public boolean hasResponses() {
        return contains(FIELD_Responses);
    }

    /**
     * Remover for responses
     * 
     * @see MultiplexedResponseContent.Fields#responses
     */
    public void removeResponses() {
        remove(FIELD_Responses);
    }

    /**
     * Getter for responses
     * 
     * @see MultiplexedResponseContent.Fields#responses
     */
    public IndividualResponseMap getResponses(GetMode mode) {
        return obtainWrapped(FIELD_Responses, IndividualResponseMap.class, mode);
    }

    /**
     * Getter for responses
     * 
     * @return
     *     Required field. Could be null for partial record.
     * @see MultiplexedResponseContent.Fields#responses
     */
    @Nonnull
    public IndividualResponseMap getResponses() {
        return obtainWrapped(FIELD_Responses, IndividualResponseMap.class, GetMode.STRICT);
    }

    /**
     * Setter for responses
     * 
     * @see MultiplexedResponseContent.Fields#responses
     */
    public MultiplexedResponseContent setResponses(IndividualResponseMap value, SetMode mode) {
        putWrapped(FIELD_Responses, IndividualResponseMap.class, value, mode);
        return this;
    }

    /**
     * Setter for responses
     * 
     * @param value
     *     Must not be null. For more control, use setters with mode instead.
     * @see MultiplexedResponseContent.Fields#responses
     */
    public MultiplexedResponseContent setResponses(
        @Nonnull
        IndividualResponseMap value) {
        putWrapped(FIELD_Responses, IndividualResponseMap.class, value, SetMode.DISALLOW_NULL);
        return this;
    }

    @Override
    public MultiplexedResponseContent clone()
        throws CloneNotSupportedException
    {
        return ((MultiplexedResponseContent) super.clone());
    }

    @Override
    public MultiplexedResponseContent copy()
        throws CloneNotSupportedException
    {
        return ((MultiplexedResponseContent) super.copy());
    }

    public static class Fields
        extends PathSpec
    {


        public Fields(List path, String name) {
            super(path, name);
        }

        public Fields() {
            super();
        }

        /**
         * Individual HTTP responses, where the key is Id of the corresponding individual request.
         * 
         */
        public com.linkedin.restli.common.multiplexer.IndividualResponseMap.Fields responses() {
            return new com.linkedin.restli.common.multiplexer.IndividualResponseMap.Fields(getPathComponents(), "responses");
        }

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy