com.google.appengine.api.search

## Class RequestStatusUtil

- java.lang.Object
- - com.google.appengine.api.search.RequestStatusUtil

-     public final class RequestStatusUtil
      extends java.lang.Object

  Collection of utility methods for SearchServicePb.RequestStatus.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RequestStatusUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static SearchServicePb.RequestStatus` | `newInvalidRequestStatus(java.lang.IllegalArgumentException e)` Creates a RequestStatus message suitable for reporting an invalid request.
    `static SearchServicePb.RequestStatus` | `newStatus(SearchServicePb.SearchServiceError.ErrorCode code)` Creates a SearchServicePb.RequestStatus from the given code.
    `static SearchServicePb.RequestStatus` | `newStatus(SearchServicePb.SearchServiceError.ErrorCode code, java.lang.String message)` Creates a SearchServicePb.RequestStatus from the given code and message.
    `static SearchServicePb.RequestStatus.Builder` | `newStatusBuilder(SearchServicePb.SearchServiceError.ErrorCode code, java.lang.String message)` Creates a SearchServicePb.RequestStatus.Builder from the given code and message.
    `static SearchServicePb.RequestStatus` | `newUnknownIndexStatus(SearchServicePb.IndexSpec indexSpec)` Creates a RequestStatus message suitable for reporting an unknown index.
    `static RequestStatus` | `reduce(java.util.Collection<RequestStatus> statuses)` For a 'batch' request, determines a single status to stand for all.
    `static Code` | `toCanonicalCode(SearchServicePb.SearchServiceError.ErrorCode appCode)` Converts SearchServicePb.SearchServiceError.ErrorCode to canonical error code.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RequestStatusUtil

          public RequestStatusUtil()

  - ### Method Detail

    - #### toCanonicalCode

          public static Code toCanonicalCode(SearchServicePb.SearchServiceError.ErrorCode appCode)

      Converts SearchServicePb.SearchServiceError.ErrorCode to canonical error code.

    - #### newStatusBuilder

          public static SearchServicePb.RequestStatus.Builder newStatusBuilder(SearchServicePb.SearchServiceError.ErrorCode code,
                                                                               java.lang.String message)

      Creates a SearchServicePb.RequestStatus.Builder from the given code and message.

    - #### newStatus

          public static SearchServicePb.RequestStatus newStatus(SearchServicePb.SearchServiceError.ErrorCode code,
                                                                java.lang.String message)

      Creates a SearchServicePb.RequestStatus from the given code and message.

    - #### newStatus

          public static SearchServicePb.RequestStatus newStatus(SearchServicePb.SearchServiceError.ErrorCode code)

      Creates a SearchServicePb.RequestStatus from the given code.

    - #### newInvalidRequestStatus

          public static SearchServicePb.RequestStatus newInvalidRequestStatus(java.lang.IllegalArgumentException e)

      Creates a RequestStatus message suitable for reporting an invalid request.

    - #### newUnknownIndexStatus

          public static SearchServicePb.RequestStatus newUnknownIndexStatus(SearchServicePb.IndexSpec indexSpec)

      Creates a RequestStatus message suitable for reporting an unknown index. We use `SearchServicePb.SearchServiceError.ErrorCode#OK` because the unknown index isn't an error condition but just a notice to the user.

    - #### reduce

          public static RequestStatus reduce(java.util.Collection<RequestStatus> statuses)

      For a 'batch' request, determines a single status to stand for all. Code will be OK if and only if the collection contains no non-OK statuses.

      If the collection is empty, the result will be an OK status with no detail.

      If the collection has one element, the result will be that element.

      If the collection has multiple elements with the same error code, the result will have that error code and the corresponding canonical code.

      If there are multiple error statuses in the collection, the one with the highest numerical code in the ErrorCode enum will be chosen as representative, and the errorDetail field of the result will contain at least the errorDetail of that status.