Class HttpBody.Builder

  • All Implemented Interfaces:
    HttpBodyOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, java.lang.Cloneable
    Enclosing class:
    HttpBody

    public static final class HttpBody.Builder
    extends com.google.protobuf.GeneratedMessage.Builder<HttpBody.Builder>
    implements HttpBodyOrBuilder
     Message that represents an arbitrary HTTP body. It should only be used for
     payload formats that can't be represented as JSON, such as raw binary or
     an HTML page.
    
    
     This message can be used both in streaming and non-streaming API methods in
     the request as well as the response.
    
     It can be used as a top-level request field, which is convenient if one
     wants to extract parameters from either the URL or HTTP template into the
     request fields and also want access to the raw HTTP body.
    
     Example:
    
     message GetResourceRequest {
     // A unique request id.
     string request_id = 1;
    
     // The raw HTTP body is bound to this field.
     google.api.HttpBody http_body = 2;
    
     }
    
     service ResourceService {
     rpc GetResource(GetResourceRequest)
     returns (google.api.HttpBody);
     rpc UpdateResource(google.api.HttpBody)
     returns (google.protobuf.Empty);
    
     }
    
     Example with streaming methods:
    
     service CaldavService {
     rpc GetCalendar(stream google.api.HttpBody)
     returns (stream google.api.HttpBody);
     rpc UpdateCalendar(stream google.api.HttpBody)
     returns (stream google.api.HttpBody);
    
     }
    
     Use of this type only changes how the request and response bodies are
     handled, all other features will continue to work unchanged.
     
    Protobuf type google.api.HttpBody
    • Method Detail

      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessage.Builder<HttpBody.Builder>
      • clear

        public HttpBody.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessage.Builder<HttpBody.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessage.Builder<HttpBody.Builder>
      • getDefaultInstanceForType

        public HttpBody getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
      • build

        public HttpBody build()
        Specified by:
        build in interface com.google.protobuf.Message.Builder
        Specified by:
        build in interface com.google.protobuf.MessageLite.Builder
      • buildPartial

        public HttpBody buildPartial()
        Specified by:
        buildPartial in interface com.google.protobuf.Message.Builder
        Specified by:
        buildPartial in interface com.google.protobuf.MessageLite.Builder
      • mergeFrom

        public HttpBody.Builder mergeFrom​(com.google.protobuf.Message other)
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<HttpBody.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessage.Builder<HttpBody.Builder>
      • mergeFrom

        public HttpBody.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                   throws java.io.IOException
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<HttpBody.Builder>
        Throws:
        java.io.IOException
      • getContentType

        public java.lang.String getContentType()
         The HTTP Content-Type header value specifying the content type of the body.
         
        string content_type = 1;
        Specified by:
        getContentType in interface HttpBodyOrBuilder
        Returns:
        The contentType.
      • getContentTypeBytes

        public com.google.protobuf.ByteString getContentTypeBytes()
         The HTTP Content-Type header value specifying the content type of the body.
         
        string content_type = 1;
        Specified by:
        getContentTypeBytes in interface HttpBodyOrBuilder
        Returns:
        The bytes for contentType.
      • setContentType

        public HttpBody.Builder setContentType​(java.lang.String value)
         The HTTP Content-Type header value specifying the content type of the body.
         
        string content_type = 1;
        Parameters:
        value - The contentType to set.
        Returns:
        This builder for chaining.
      • clearContentType

        public HttpBody.Builder clearContentType()
         The HTTP Content-Type header value specifying the content type of the body.
         
        string content_type = 1;
        Returns:
        This builder for chaining.
      • setContentTypeBytes

        public HttpBody.Builder setContentTypeBytes​(com.google.protobuf.ByteString value)
         The HTTP Content-Type header value specifying the content type of the body.
         
        string content_type = 1;
        Parameters:
        value - The bytes for contentType to set.
        Returns:
        This builder for chaining.
      • getData

        public com.google.protobuf.ByteString getData()
         The HTTP request/response body as raw binary.
         
        bytes data = 2;
        Specified by:
        getData in interface HttpBodyOrBuilder
        Returns:
        The data.
      • setData

        public HttpBody.Builder setData​(com.google.protobuf.ByteString value)
         The HTTP request/response body as raw binary.
         
        bytes data = 2;
        Parameters:
        value - The data to set.
        Returns:
        This builder for chaining.
      • clearData

        public HttpBody.Builder clearData()
         The HTTP request/response body as raw binary.
         
        bytes data = 2;
        Returns:
        This builder for chaining.
      • getExtensionsList

        public java.util.List<Any> getExtensionsList()
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
        Specified by:
        getExtensionsList in interface HttpBodyOrBuilder
      • getExtensionsCount

        public int getExtensionsCount()
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
        Specified by:
        getExtensionsCount in interface HttpBodyOrBuilder
      • getExtensions

        public Any getExtensions​(int index)
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
        Specified by:
        getExtensions in interface HttpBodyOrBuilder
      • setExtensions

        public HttpBody.Builder setExtensions​(int index,
                                              Any value)
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
      • setExtensions

        public HttpBody.Builder setExtensions​(int index,
                                              Any.Builder builderForValue)
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
      • addExtensions

        public HttpBody.Builder addExtensions​(Any value)
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
      • addExtensions

        public HttpBody.Builder addExtensions​(int index,
                                              Any value)
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
      • addExtensions

        public HttpBody.Builder addExtensions​(Any.Builder builderForValue)
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
      • addExtensions

        public HttpBody.Builder addExtensions​(int index,
                                              Any.Builder builderForValue)
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
      • addAllExtensions

        public HttpBody.Builder addAllExtensions​(java.lang.Iterable<? extends Any> values)
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
      • clearExtensions

        public HttpBody.Builder clearExtensions()
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
      • removeExtensions

        public HttpBody.Builder removeExtensions​(int index)
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
      • getExtensionsBuilder

        public Any.Builder getExtensionsBuilder​(int index)
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
      • getExtensionsOrBuilder

        public AnyOrBuilder getExtensionsOrBuilder​(int index)
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
        Specified by:
        getExtensionsOrBuilder in interface HttpBodyOrBuilder
      • getExtensionsOrBuilderList

        public java.util.List<? extends AnyOrBuilder> getExtensionsOrBuilderList()
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
        Specified by:
        getExtensionsOrBuilderList in interface HttpBodyOrBuilder
      • addExtensionsBuilder

        public Any.Builder addExtensionsBuilder()
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
      • addExtensionsBuilder

        public Any.Builder addExtensionsBuilder​(int index)
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;
      • getExtensionsBuilderList

        public java.util.List<Any.Builder> getExtensionsBuilderList()
         Application specific response metadata. Must be set in the first response
         for streaming APIs.
         
        repeated .google.protobuf.Any extensions = 3;