本文整理了Java中com.google.rpc.Status.getDetailsList()
方法的一些代码示例,展示了Status.getDetailsList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Status.getDetailsList()
方法的具体详情如下:
包路径:com.google.rpc.Status
类名称:Status
方法名: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;`
[中]```
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;
代码示例来源:origin: com.xorlev.grpc-jersey/jersey-rpc-support
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.rpc.Status)) {
return super.equals(obj);
}
com.google.rpc.Status other = (com.google.rpc.Status) obj;
boolean result = true;
result = result && (getCode()
== other.getCode());
result = result && getMessage()
.equals(other.getMessage());
result = result && getDetailsList()
.equals(other.getDetailsList());
result = result && unknownFields.equals(other.unknownFields);
return result;
}
代码示例来源:origin: envoyproxy/java-control-plane
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.rpc.Status)) {
return super.equals(obj);
}
com.google.rpc.Status other = (com.google.rpc.Status) obj;
boolean result = true;
result = result && (getCode()
== other.getCode());
result = result && getMessage()
.equals(other.getMessage());
result = result && getDetailsList()
.equals(other.getDetailsList());
result = result && unknownFields.equals(other.unknownFields);
return result;
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.rpc.Status)) {
return super.equals(obj);
}
com.google.rpc.Status other = (com.google.rpc.Status) obj;
boolean result = true;
result = result && (getCode()
== other.getCode());
result = result && getMessage()
.equals(other.getMessage());
result = result && getDetailsList()
.equals(other.getDetailsList());
return result;
}
代码示例来源:origin: envoyproxy/java-control-plane
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + CODE_FIELD_NUMBER;
hash = (53 * hash) + getCode();
hash = (37 * hash) + MESSAGE_FIELD_NUMBER;
hash = (53 * hash) + getMessage().hashCode();
if (getDetailsCount() > 0) {
hash = (37 * hash) + DETAILS_FIELD_NUMBER;
hash = (53 * hash) + getDetailsList().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
代码示例来源:origin: com.xorlev.grpc-jersey/jersey-rpc-support
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + CODE_FIELD_NUMBER;
hash = (53 * hash) + getCode();
hash = (37 * hash) + MESSAGE_FIELD_NUMBER;
hash = (53 * hash) + getMessage().hashCode();
if (getDetailsCount() > 0) {
hash = (37 * hash) + DETAILS_FIELD_NUMBER;
hash = (53 * hash) + getDetailsList().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + CODE_FIELD_NUMBER;
hash = (53 * hash) + getCode();
hash = (37 * hash) + MESSAGE_FIELD_NUMBER;
hash = (53 * hash) + getMessage().hashCode();
if (getDetailsCount() > 0) {
hash = (37 * hash) + DETAILS_FIELD_NUMBER;
hash = (53 * hash) + getDetailsList().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
代码示例来源:origin: com.xorlev.grpc-jersey/jersey-rpc-support
@Override
public Optional<String> handleStreamingError(Throwable t) throws InvalidProtocolBufferException {
Status grpcError = GrpcErrorUtil.throwableToStatus(t).getPayload();
// JsonFormat doesn't support serializing Any.
if (!grpcError.getDetailsList().isEmpty()) {
grpcError = grpcError.toBuilder().clearDetails().build();
}
return Optional.of(JsonHandler.streamPrinter().print(grpcError));
}
}
代码示例来源:origin: com.xorlev.grpc-jersey/jersey-rpc-support
public static Response createJerseyResponse(Throwable t) {
GrpcErrorUtil.GrpcError grpcError = GrpcErrorUtil.throwableToStatus(t);
int httpStatusCode = GrpcErrorUtil.grpcToHttpStatus(grpcError.getStatus());
Response.ResponseBuilder httpResponse = Response.status(httpStatusCode);
try {
for (Any extra : grpcError.getPayload().getDetailsList()) {
if (extra.is(RetryInfo.class)) {
RetryInfo retryInfo = extra.unpack(RetryInfo.class);
if (retryInfo.hasRetryDelay()) {
httpResponse.header("Retry-After", Durations.toSeconds(retryInfo.getRetryDelay()));
}
}
}
httpResponse.entity(JsonFormat.printer().print(grpcError.getPayload().toBuilder().clearDetails().build()));
} catch (InvalidProtocolBufferException e) {
// this should never happen
throw new RuntimeException(e);
}
return httpResponse.build();
}
代码示例来源:origin: GoogleCloudPlatform/cloud-bigtable-client
private static StatusRuntimeException toException(Status status) {
io.grpc.Status grpcStatus = io.grpc.Status
.fromCodeValue(status.getCode())
.withDescription(status.getMessage());
for (Any detail : status.getDetailsList()) {
grpcStatus = grpcStatus.augmentDescription(detail.toString());
}
return grpcStatus.asRuntimeException();
}
内容来源于网络,如有侵权,请联系作者删除!