com.google.rpc.Status.newBuilder()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中com.google.rpc.Status.newBuilder()方法的一些代码示例,展示了Status.newBuilder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Status.newBuilder()方法的具体详情如下:
包路径:com.google.rpc.Status
类名称:Status
方法名:newBuilder

Status.newBuilder介绍

暂无

代码示例

代码示例来源:origin: googleapis/google-cloud-java

/** <code>.google.rpc.Status details = 1;</code> */
public Builder mergeDetails(com.google.rpc.Status value) {
 if (detailsBuilder_ == null) {
  if (details_ != null) {
   details_ = com.google.rpc.Status.newBuilder(details_).mergeFrom(value).buildPartial();
  } else {
   details_ = value;
  }
  onChanged();
 } else {
  detailsBuilder_.mergeFrom(value);
 }
 return this;
}
/** <code>.google.rpc.Status details = 1;</code> */

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * The error that resulted in this change, if applicable.
 * </pre>
 *
 * <code>.google.rpc.Status cause = 3;</code>
 */
public Builder mergeCause(com.google.rpc.Status value) {
 if (causeBuilder_ == null) {
  if (cause_ != null) {
   cause_ = com.google.rpc.Status.newBuilder(cause_).mergeFrom(value).buildPartial();
  } else {
   cause_ = value;
  }
  onChanged();
 } else {
  causeBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * An optional final status for this span.
 * </pre>
 *
 * <code>.google.rpc.Status status = 11;</code>
 */
public Builder mergeStatus(com.google.rpc.Status value) {
 if (statusBuilder_ == null) {
  if (status_ != null) {
   status_ = com.google.rpc.Status.newBuilder(status_).mergeFrom(value).buildPartial();
  } else {
   status_ = value;
  }
  onChanged();
 } else {
  statusBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * The status of the requested write operation.
 * </pre>
 *
 * <code>.google.rpc.Status status = 2;</code>
 */
public Builder mergeStatus(com.google.rpc.Status value) {
 if (statusBuilder_ == null) {
  if (status_ != null) {
   status_ = com.google.rpc.Status.newBuilder(status_).mergeFrom(value).buildPartial();
  } else {
   status_ = value;
  }
  onChanged();
 } else {
  statusBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * The error that resulted in this change, if applicable.
 * </pre>
 *
 * <code>.google.rpc.Status cause = 3;</code>
 */
public Builder mergeCause(com.google.rpc.Status value) {
 if (causeBuilder_ == null) {
  if (cause_ != null) {
   cause_ = com.google.rpc.Status.newBuilder(cause_).mergeFrom(value).buildPartial();
  } else {
   cause_ = value;
  }
  onChanged();
 } else {
  causeBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * If set, indicates an error. Note that for a single `AnnotateVideoRequest`
 * some videos may succeed and some may fail.
 * </pre>
 *
 * <code>.google.rpc.Status error = 9;</code>
 */
public Builder mergeError(com.google.rpc.Status value) {
 if (errorBuilder_ == null) {
  if (error_ != null) {
   error_ = com.google.rpc.Status.newBuilder(error_).mergeFrom(value).buildPartial();
  } else {
   error_ = value;
  }
  onChanged();
 } else {
  errorBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * Specifies the status of the webhook request.
 * </pre>
 *
 * <code>.google.rpc.Status webhook_status = 4;</code>
 */
public Builder mergeWebhookStatus(com.google.rpc.Status value) {
 if (webhookStatusBuilder_ == null) {
  if (webhookStatus_ != null) {
   webhookStatus_ =
     com.google.rpc.Status.newBuilder(webhookStatus_).mergeFrom(value).buildPartial();
  } else {
   webhookStatus_ = value;
  }
  onChanged();
 } else {
  webhookStatusBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * If set, indicates an error. Note that for a single `AnnotateVideoRequest`
 * some videos may succeed and some may fail.
 * </pre>
 *
 * <code>.google.rpc.Status error = 9;</code>
 */
public Builder mergeError(com.google.rpc.Status value) {
 if (errorBuilder_ == null) {
  if (error_ != null) {
   error_ = com.google.rpc.Status.newBuilder(error_).mergeFrom(value).buildPartial();
  } else {
   error_ = value;
  }
  onChanged();
 } else {
  errorBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * If set, indicates an error. Note that for a single `AnnotateVideoRequest`
 * some videos may succeed and some may fail.
 * </pre>
 *
 * <code>.google.rpc.Status error = 9;</code>
 */
public Builder mergeError(com.google.rpc.Status value) {
 if (errorBuilder_ == null) {
  if (error_ != null) {
   error_ = com.google.rpc.Status.newBuilder(error_).mergeFrom(value).buildPartial();
  } else {
   error_ = value;
  }
  onChanged();
 } else {
  errorBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * If set, indicates an error. Note that for a single `AnnotateVideoRequest`
 * some videos may succeed and some may fail.
 * </pre>
 *
 * <code>.google.rpc.Status error = 5;</code>
 */
public Builder mergeError(com.google.rpc.Status value) {
 if (errorBuilder_ == null) {
  if (error_ != null) {
   error_ = com.google.rpc.Status.newBuilder(error_).mergeFrom(value).buildPartial();
  } else {
   error_ = value;
  }
  onChanged();
 } else {
  errorBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * Specifies the status of the webhook request.
 * </pre>
 *
 * <code>.google.rpc.Status webhook_status = 4;</code>
 */
public Builder mergeWebhookStatus(com.google.rpc.Status value) {
 if (webhookStatusBuilder_ == null) {
  if (webhookStatus_ != null) {
   webhookStatus_ =
     com.google.rpc.Status.newBuilder(webhookStatus_).mergeFrom(value).buildPartial();
  } else {
   webhookStatus_ = value;
  }
  onChanged();
 } else {
  webhookStatusBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that
 * specifies the error for the operation.
 * </pre>
 *
 * <code>.google.rpc.Status error = 1;</code>
 */
public Builder mergeError(com.google.rpc.Status value) {
 if (errorBuilder_ == null) {
  if (error_ != null) {
   error_ = com.google.rpc.Status.newBuilder(error_).mergeFrom(value).buildPartial();
  } else {
   error_ = value;
  }
  onChanged();
 } else {
  errorBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * If set, represents the error message for the operation.
 * Note that filled-in image annotations are guaranteed to be
 * correct, even when `error` is set.
 * </pre>
 *
 * <code>.google.rpc.Status error = 9;</code>
 */
public Builder mergeError(com.google.rpc.Status value) {
 if (errorBuilder_ == null) {
  if (error_ != null) {
   error_ = com.google.rpc.Status.newBuilder(error_).mergeFrom(value).buildPartial();
  } else {
   error_ = value;
  }
  onChanged();
 } else {
  errorBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * If set, represents the error message for the operation.
 * Note that filled-in image annotations are guaranteed to be
 * correct, even when `error` is set.
 * </pre>
 *
 * <code>.google.rpc.Status error = 9;</code>
 */
public Builder mergeError(com.google.rpc.Status value) {
 if (errorBuilder_ == null) {
  if (error_ != null) {
   error_ = com.google.rpc.Status.newBuilder(error_).mergeFrom(value).buildPartial();
  } else {
   error_ = value;
  }
  onChanged();
 } else {
  errorBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * If set, represents the error message for the operation.
 * Note that filled-in image annotations are guaranteed to be
 * correct, even when `error` is set.
 * </pre>
 *
 * <code>.google.rpc.Status error = 9;</code>
 */
public Builder mergeError(com.google.rpc.Status value) {
 if (errorBuilder_ == null) {
  if (error_ != null) {
   error_ = com.google.rpc.Status.newBuilder(error_).mergeFrom(value).buildPartial();
  } else {
   error_ = value;
  }
  onChanged();
 } else {
  errorBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * If set, represents the error message for the operation.
 * Note that filled-in image annotations are guaranteed to be
 * correct, even when `error` is set.
 * </pre>
 *
 * <code>.google.rpc.Status error = 9;</code>
 */
public Builder mergeError(com.google.rpc.Status value) {
 if (errorBuilder_ == null) {
  if (error_ != null) {
   error_ = com.google.rpc.Status.newBuilder(error_).mergeFrom(value).buildPartial();
  } else {
   error_ = value;
  }
  onChanged();
 } else {
  errorBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * Specifies the status of the webhook request. `webhook_status`
 * is never populated in webhook requests.
 * </pre>
 *
 * <code>.google.rpc.Status webhook_status = 3;</code>
 */
public Builder mergeWebhookStatus(com.google.rpc.Status value) {
 if (webhookStatusBuilder_ == null) {
  if (webhookStatus_ != null) {
   webhookStatus_ =
     com.google.rpc.Status.newBuilder(webhookStatus_).mergeFrom(value).buildPartial();
  } else {
   webhookStatus_ = value;
  }
  onChanged();
 } else {
  webhookStatusBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

/**
 *
 *
 * <pre>
 * Output only. The response from the target for the last attempted execution.
 * </pre>
 *
 * <code>.google.rpc.Status status = 11;</code>
 */
public Builder mergeStatus(com.google.rpc.Status value) {
 if (statusBuilder_ == null) {
  if (status_ != null) {
   status_ = com.google.rpc.Status.newBuilder(status_).mergeFrom(value).buildPartial();
  } else {
   status_ = value;
  }
  onChanged();
 } else {
  statusBuilder_.mergeFrom(value);
 }
 return this;
}
/**

代码示例来源:origin: googleapis/google-cloud-java

private ListenResponse removeTarget(@Nullable Code code) {
 TargetChange.Builder targetChange =
   TargetChange.newBuilder()
     .setTargetChangeType(TargetChangeType.REMOVE)
     .addTargetIds(TARGET_ID);
 if (code != null) {
  targetChange.setCause(Status.newBuilder().setCode(code.value()));
 }
 ListenResponse.Builder response = ListenResponse.newBuilder();
 response.setTargetChange(targetChange);
 return response.build();
}

代码示例来源:origin: googleapis/google-cloud-java

@Test
public void failedOperation() {
 com.google.longrunning.Operation proto =
   newBuilder()
     .setName("op1")
     .setDone(true)
     .setError(Status.newBuilder().setCode(Code.NOT_FOUND.getNumber()))
     .build();
 Operation<Database, String> op = Operation.create(rpc, proto, new ParserImpl());
 assertThat(op.getName()).isEqualTo("op1");
 assertThat(op.isDone()).isTrue();
 assertThat(op.isSuccessful()).isFalse();
 assertThat(op.getMetadata()).isNull();
 expectedException.expect(isSpannerException(ErrorCode.NOT_FOUND));
 op.getResult();
}

相关文章