Class RequestStatusUtil (2.0.0)

public final class RequestStatusUtil

Collection of utility methods for SearchServicePb.RequestStatus.

Inheritance

java.lang.Object > RequestStatusUtil

Static Methods

newInvalidRequestStatus(IllegalArgumentException e)

public static SearchServicePb.RequestStatus newInvalidRequestStatus(IllegalArgumentException e)

Creates a RequestStatus message suitable for reporting an invalid request.

Parameter
NameDescription
eIllegalArgumentException
Returns
TypeDescription
com.google.appengine.api.search.proto.SearchServicePb.RequestStatus

newStatus(SearchServicePb.SearchServiceError.ErrorCode code)

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

Creates a SearchServicePb.RequestStatus from the given code.

Parameter
NameDescription
codecom.google.appengine.api.search.proto.SearchServicePb.SearchServiceError.ErrorCode
Returns
TypeDescription
com.google.appengine.api.search.proto.SearchServicePb.RequestStatus

newStatus(SearchServicePb.SearchServiceError.ErrorCode code, String message)

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

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

Parameters
NameDescription
codecom.google.appengine.api.search.proto.SearchServicePb.SearchServiceError.ErrorCode
messageString
Returns
TypeDescription
com.google.appengine.api.search.proto.SearchServicePb.RequestStatus

newStatusBuilder(SearchServicePb.SearchServiceError.ErrorCode code, String message)

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

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

Parameters
NameDescription
codecom.google.appengine.api.search.proto.SearchServicePb.SearchServiceError.ErrorCode
messageString
Returns
TypeDescription
com.google.appengine.api.search.proto.SearchServicePb.RequestStatus.Builder

newUnknownIndexStatus(SearchServicePb.IndexSpec indexSpec)

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.

Parameter
NameDescription
indexSpeccom.google.appengine.api.search.proto.SearchServicePb.IndexSpec
Returns
TypeDescription
com.google.appengine.api.search.proto.SearchServicePb.RequestStatus

reduce(Collection<SearchServicePb.RequestStatus> statuses)

public static SearchServicePb.RequestStatus reduce(Collection<SearchServicePb.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.

Parameter
NameDescription
statusesCollection<com.google.appengine.api.search.proto.SearchServicePb.RequestStatus>
Returns
TypeDescription
com.google.appengine.api.search.proto.SearchServicePb.RequestStatus

toCanonicalCode(SearchServicePb.SearchServiceError.ErrorCode appCode)

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

Converts SearchServicePb.SearchServiceError.ErrorCode to canonical error code.

Parameter
NameDescription
appCodecom.google.appengine.api.search.proto.SearchServicePb.SearchServiceError.ErrorCode
Returns
TypeDescription
com.google.apphosting.base.protos.Codes.Code

Constructors

RequestStatusUtil()

public RequestStatusUtil()