程序包 com.google.rpc

类 Status.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderType>
com.google.protobuf.GeneratedMessageV3.Builder<Status.Builder>
com.google.rpc.Status.Builder
所有已实现的接口:
com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, StatusOrBuilder, Cloneable
封闭类:
Status

public static final class Status.Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Status.Builder> implements StatusOrBuilder
 The `Status` type defines a logical error model that is suitable for different
 programming environments, including REST APIs and RPC APIs. It is used by
 [gRPC](https://github.com/grpc). The error model is designed to be:
 - Simple to use and understand for most users
 - Flexible enough to meet unexpected needs
 # Overview
 The `Status` message contains three pieces of data: error code, error message,
 and error details. The error code should be an enum value of
 [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed.  The
 error message should be a developer-facing English message that helps
 developers *understand* and *resolve* the error. If a localized user-facing
 error message is needed, put the localized message in the error details or
 localize it in the client. The optional error details may contain arbitrary
 information about the error. There is a predefined set of error detail types
 in the package `google.rpc` that can be used for common error conditions.
 # Language mapping
 The `Status` message is the logical representation of the error model, but it
 is not necessarily the actual wire format. When the `Status` message is
 exposed in different client libraries and different wire protocols, it can be
 mapped differently. For example, it will likely be mapped to some exceptions
 in Java, but more likely mapped to some error codes in C.
 # Other uses
 The error model and the `Status` message can be used in a variety of
 environments, either with or without APIs, to provide a
 consistent developer experience across different environments.
 Example uses of this error model include:
 - Partial errors. If a service needs to return partial errors to the client,
     it may embed the `Status` in the normal response to indicate the partial
     errors.
 - Workflow errors. A typical workflow has multiple steps. Each step may
     have a `Status` message for error reporting.
 - Batch operations. If a client uses batch request and batch response, the
     `Status` message should be used directly inside batch response, one for
     each error sub-response.
 - Asynchronous operations. If an API call embeds asynchronous operation
     results in its response, the status of those operations should be
     represented directly using the `Status` message.
 - Logging. If some API errors are stored in logs, the message `Status` could
     be used directly after any stripping needed for security/privacy reasons.
 
Protobuf type google.rpc.Status
  • 方法概要

    修饰符和类型
    方法
    说明
    addAllDetails​(Iterable<? extends com.google.protobuf.Any> values)
    A list of messages that carry the error details.
    addDetails​(int index, com.google.protobuf.Any value)
    A list of messages that carry the error details.
    addDetails​(int index, com.google.protobuf.Any.Builder builderForValue)
    A list of messages that carry the error details.
    addDetails​(com.google.protobuf.Any value)
    A list of messages that carry the error details.
    addDetails​(com.google.protobuf.Any.Builder builderForValue)
    A list of messages that carry the error details.
    com.google.protobuf.Any.Builder
    A list of messages that carry the error details.
    com.google.protobuf.Any.Builder
    addDetailsBuilder​(int index)
    A list of messages that carry the error details.
    addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
     
     
     
     
    The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
    A list of messages that carry the error details.
    clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
     
    A developer-facing error message, which should be in English.
    clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
     
     
    int
    The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
     
    static com.google.protobuf.Descriptors.Descriptor
     
    com.google.protobuf.Descriptors.Descriptor
     
    com.google.protobuf.Any
    getDetails​(int index)
    A list of messages that carry the error details.
    com.google.protobuf.Any.Builder
    getDetailsBuilder​(int index)
    A list of messages that carry the error details.
    List<com.google.protobuf.Any.Builder>
    A list of messages that carry the error details.
    int
    A list of messages that carry the error details.
    List<com.google.protobuf.Any>
    A list of messages that carry the error details.
    com.google.protobuf.AnyOrBuilder
    getDetailsOrBuilder​(int index)
    A list of messages that carry the error details.
    List<? extends com.google.protobuf.AnyOrBuilder>
    A list of messages that carry the error details.
    A developer-facing error message, which should be in English.
    com.google.protobuf.ByteString
    A developer-facing error message, which should be in English.
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
     
    boolean
     
    mergeFrom​(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    mergeFrom​(com.google.protobuf.Message other)
     
    mergeFrom​(Status other)
     
    mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
     
    removeDetails​(int index)
    A list of messages that carry the error details.
    setCode​(int value)
    The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
    setDetails​(int index, com.google.protobuf.Any value)
    A list of messages that carry the error details.
    setDetails​(int index, com.google.protobuf.Any.Builder builderForValue)
    A list of messages that carry the error details.
    setField​(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
     
    setMessage​(String value)
    A developer-facing error message, which should be in English.
    setMessageBytes​(com.google.protobuf.ByteString value)
    A developer-facing error message, which should be in English.
    setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)
     
    setUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
     

    从类继承的方法 com.google.protobuf.GeneratedMessageV3.Builder

    getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, internalGetMapField, internalGetMutableMapField, isClean, markClean, newBuilderForField, onBuilt, onChanged, setUnknownFieldsProto3

    从类继承的方法 com.google.protobuf.AbstractMessage.Builder

    findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString

    从类继承的方法 com.google.protobuf.AbstractMessageLite.Builder

    addAll, addAll, mergeFrom, newUninitializedMessageException

    从类继承的方法 java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    从接口继承的方法 com.google.protobuf.MessageLite.Builder

    mergeFrom

    从接口继承的方法 com.google.protobuf.MessageOrBuilder

    findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
  • 方法详细资料

    • getDescriptor

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

      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
      指定者:
      internalGetFieldAccessorTable 在类中 com.google.protobuf.GeneratedMessageV3.Builder<Status.Builder>
    • clear

      public Status.Builder clear()
      指定者:
      clear 在接口中 com.google.protobuf.Message.Builder
      指定者:
      clear 在接口中 com.google.protobuf.MessageLite.Builder
      覆盖:
      clear 在类中 com.google.protobuf.GeneratedMessageV3.Builder<Status.Builder>
    • getDescriptorForType

      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
      指定者:
      getDescriptorForType 在接口中 com.google.protobuf.Message.Builder
      指定者:
      getDescriptorForType 在接口中 com.google.protobuf.MessageOrBuilder
      覆盖:
      getDescriptorForType 在类中 com.google.protobuf.GeneratedMessageV3.Builder<Status.Builder>
    • getDefaultInstanceForType

      public Status getDefaultInstanceForType()
      指定者:
      getDefaultInstanceForType 在接口中 com.google.protobuf.MessageLiteOrBuilder
      指定者:
      getDefaultInstanceForType 在接口中 com.google.protobuf.MessageOrBuilder
    • build

      public Status build()
      指定者:
      build 在接口中 com.google.protobuf.Message.Builder
      指定者:
      build 在接口中 com.google.protobuf.MessageLite.Builder
    • buildPartial

      public Status buildPartial()
      指定者:
      buildPartial 在接口中 com.google.protobuf.Message.Builder
      指定者:
      buildPartial 在接口中 com.google.protobuf.MessageLite.Builder
    • clone

      public Status.Builder clone()
      指定者:
      clone 在接口中 com.google.protobuf.Message.Builder
      指定者:
      clone 在接口中 com.google.protobuf.MessageLite.Builder
      覆盖:
      clone 在类中 com.google.protobuf.GeneratedMessageV3.Builder<Status.Builder>
    • setField

      public Status.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
      指定者:
      setField 在接口中 com.google.protobuf.Message.Builder
      覆盖:
      setField 在类中 com.google.protobuf.GeneratedMessageV3.Builder<Status.Builder>
    • clearField

      public Status.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
      指定者:
      clearField 在接口中 com.google.protobuf.Message.Builder
      覆盖:
      clearField 在类中 com.google.protobuf.GeneratedMessageV3.Builder<Status.Builder>
    • clearOneof

      public Status.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
      指定者:
      clearOneof 在接口中 com.google.protobuf.Message.Builder
      覆盖:
      clearOneof 在类中 com.google.protobuf.GeneratedMessageV3.Builder<Status.Builder>
    • setRepeatedField

      public Status.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)
      指定者:
      setRepeatedField 在接口中 com.google.protobuf.Message.Builder
      覆盖:
      setRepeatedField 在类中 com.google.protobuf.GeneratedMessageV3.Builder<Status.Builder>
    • addRepeatedField

      public Status.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
      指定者:
      addRepeatedField 在接口中 com.google.protobuf.Message.Builder
      覆盖:
      addRepeatedField 在类中 com.google.protobuf.GeneratedMessageV3.Builder<Status.Builder>
    • mergeFrom

      public Status.Builder mergeFrom(com.google.protobuf.Message other)
      指定者:
      mergeFrom 在接口中 com.google.protobuf.Message.Builder
      覆盖:
      mergeFrom 在类中 com.google.protobuf.AbstractMessage.Builder<Status.Builder>
    • mergeFrom

      public Status.Builder mergeFrom(Status other)
    • isInitialized

      public final boolean isInitialized()
      指定者:
      isInitialized 在接口中 com.google.protobuf.MessageLiteOrBuilder
      覆盖:
      isInitialized 在类中 com.google.protobuf.GeneratedMessageV3.Builder<Status.Builder>
    • mergeFrom

      public Status.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      指定者:
      mergeFrom 在接口中 com.google.protobuf.Message.Builder
      指定者:
      mergeFrom 在接口中 com.google.protobuf.MessageLite.Builder
      覆盖:
      mergeFrom 在类中 com.google.protobuf.AbstractMessage.Builder<Status.Builder>
      抛出:
      IOException
    • getCode

      public int getCode()
       The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
       
      int32 code = 1;
      指定者:
      getCode 在接口中 StatusOrBuilder
      返回:
      The code.
    • setCode

      public Status.Builder setCode(int value)
       The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
       
      int32 code = 1;
      参数:
      value - The code to set.
      返回:
      This builder for chaining.
    • clearCode

      public Status.Builder clearCode()
       The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
       
      int32 code = 1;
      返回:
      This builder for chaining.
    • getMessage

      public String getMessage()
       A developer-facing error message, which should be in English. Any
       user-facing error message should be localized and sent in the
       [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
       
      string message = 2;
      指定者:
      getMessage 在接口中 StatusOrBuilder
      返回:
      The message.
    • getMessageBytes

      public com.google.protobuf.ByteString getMessageBytes()
       A developer-facing error message, which should be in English. Any
       user-facing error message should be localized and sent in the
       [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
       
      string message = 2;
      指定者:
      getMessageBytes 在接口中 StatusOrBuilder
      返回:
      The bytes for message.
    • setMessage

      public Status.Builder setMessage(String value)
       A developer-facing error message, which should be in English. Any
       user-facing error message should be localized and sent in the
       [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
       
      string message = 2;
      参数:
      value - The message to set.
      返回:
      This builder for chaining.
    • clearMessage

      public Status.Builder clearMessage()
       A developer-facing error message, which should be in English. Any
       user-facing error message should be localized and sent in the
       [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
       
      string message = 2;
      返回:
      This builder for chaining.
    • setMessageBytes

      public Status.Builder setMessageBytes(com.google.protobuf.ByteString value)
       A developer-facing error message, which should be in English. Any
       user-facing error message should be localized and sent in the
       [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
       
      string message = 2;
      参数:
      value - The bytes for message to set.
      返回:
      This builder for chaining.
    • getDetailsList

      public List<com.google.protobuf.Any> getDetailsList()
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
      指定者:
      getDetailsList 在接口中 StatusOrBuilder
    • getDetailsCount

      public int getDetailsCount()
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
      指定者:
      getDetailsCount 在接口中 StatusOrBuilder
    • getDetails

      public com.google.protobuf.Any getDetails(int index)
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
      指定者:
      getDetails 在接口中 StatusOrBuilder
    • setDetails

      public Status.Builder setDetails(int index, com.google.protobuf.Any value)
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
    • setDetails

      public Status.Builder setDetails(int index, com.google.protobuf.Any.Builder builderForValue)
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
    • addDetails

      public Status.Builder addDetails(com.google.protobuf.Any value)
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
    • addDetails

      public Status.Builder addDetails(int index, com.google.protobuf.Any value)
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
    • addDetails

      public Status.Builder addDetails(com.google.protobuf.Any.Builder builderForValue)
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
    • addDetails

      public Status.Builder addDetails(int index, com.google.protobuf.Any.Builder builderForValue)
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
    • addAllDetails

      public Status.Builder addAllDetails(Iterable<? extends com.google.protobuf.Any> values)
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
    • clearDetails

      public Status.Builder clearDetails()
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
    • removeDetails

      public Status.Builder removeDetails(int index)
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
    • getDetailsBuilder

      public com.google.protobuf.Any.Builder getDetailsBuilder(int index)
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
    • getDetailsOrBuilder

      public com.google.protobuf.AnyOrBuilder getDetailsOrBuilder(int index)
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
      指定者:
      getDetailsOrBuilder 在接口中 StatusOrBuilder
    • getDetailsOrBuilderList

      public List<? extends com.google.protobuf.AnyOrBuilder> getDetailsOrBuilderList()
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
      指定者:
      getDetailsOrBuilderList 在接口中 StatusOrBuilder
    • addDetailsBuilder

      public com.google.protobuf.Any.Builder addDetailsBuilder()
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
    • addDetailsBuilder

      public com.google.protobuf.Any.Builder addDetailsBuilder(int index)
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
    • getDetailsBuilderList

      public List<com.google.protobuf.Any.Builder> getDetailsBuilderList()
       A list of messages that carry the error details.  There is a common set of
       message types for APIs to use.
       
      repeated .google.protobuf.Any details = 3;
    • setUnknownFields

      public final Status.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
      指定者:
      setUnknownFields 在接口中 com.google.protobuf.Message.Builder
      覆盖:
      setUnknownFields 在类中 com.google.protobuf.GeneratedMessageV3.Builder<Status.Builder>
    • mergeUnknownFields

      public final Status.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
      指定者:
      mergeUnknownFields 在接口中 com.google.protobuf.Message.Builder
      覆盖:
      mergeUnknownFields 在类中 com.google.protobuf.GeneratedMessageV3.Builder<Status.Builder>