com.google.protobuf.Any.getDefaultInstance()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(245)

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

Any.getDefaultInstance介绍

暂无

代码示例

代码示例来源:origin: com.google.protobuf/protobuf-java

@java.lang.Override
public com.google.protobuf.Any getDefaultInstanceForType() {
 return com.google.protobuf.Any.getDefaultInstance();
}

代码示例来源:origin: com.google.protobuf/protobuf-java

/**
 * <pre>
 * The option's value packed in an Any message. If the value is a primitive,
 * the corresponding wrapper type defined in google/protobuf/wrappers.proto
 * should be used. If the value is an enum, it should be stored as an int32
 * value using the google.protobuf.Int32Value type.
 * </pre>
 *
 * <code>.google.protobuf.Any value = 2;</code>
 */
public com.google.protobuf.Any getValue() {
 return value_ == null ? com.google.protobuf.Any.getDefaultInstance() : value_;
}
/**

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

/**
 *
 *
 * <pre>
 * The log entry payload, represented as a protocol buffer.  Some
 * Google Cloud Platform services use this field for their log
 * entry payloads.
 * </pre>
 *
 * <code>.google.protobuf.Any proto_payload = 2;</code>
 */
public com.google.protobuf.AnyOrBuilder getProtoPayloadOrBuilder() {
 if (payloadCase_ == 2) {
  return (com.google.protobuf.Any) payload_;
 }
 return com.google.protobuf.Any.getDefaultInstance();
}

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

/**
 *
 *
 * <pre>
 * The log entry payload, represented as a protocol buffer.  Some
 * Google Cloud Platform services use this field for their log
 * entry payloads.
 * </pre>
 *
 * <code>.google.protobuf.Any proto_payload = 2;</code>
 */
public com.google.protobuf.Any getProtoPayload() {
 if (payloadCase_ == 2) {
  return (com.google.protobuf.Any) payload_;
 }
 return com.google.protobuf.Any.getDefaultInstance();
}
/**

代码示例来源:origin: com.google.protobuf/protobuf-java

/**
 * <pre>
 * The option's value packed in an Any message. If the value is a primitive,
 * the corresponding wrapper type defined in google/protobuf/wrappers.proto
 * should be used. If the value is an enum, it should be stored as an int32
 * value using the google.protobuf.Int32Value type.
 * </pre>
 *
 * <code>.google.protobuf.Any value = 2;</code>
 */
public com.google.protobuf.Any getValue() {
 if (valueBuilder_ == null) {
  return value_ == null ? com.google.protobuf.Any.getDefaultInstance() : value_;
 } else {
  return valueBuilder_.getMessage();
 }
}
/**

代码示例来源:origin: com.google.protobuf/protobuf-java

/**
 * <pre>
 * The option's value packed in an Any message. If the value is a primitive,
 * the corresponding wrapper type defined in google/protobuf/wrappers.proto
 * should be used. If the value is an enum, it should be stored as an int32
 * value using the google.protobuf.Int32Value type.
 * </pre>
 *
 * <code>.google.protobuf.Any value = 2;</code>
 */
public com.google.protobuf.AnyOrBuilder getValueOrBuilder() {
 if (valueBuilder_ != null) {
  return valueBuilder_.getMessageOrBuilder();
 } else {
  return value_ == null ?
    com.google.protobuf.Any.getDefaultInstance() : value_;
 }
}
/**

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

/**
 *
 *
 * <pre>
 * The log entry payload, represented as a protocol buffer.  Some
 * Google Cloud Platform services use this field for their log
 * entry payloads.
 * </pre>
 *
 * <code>.google.protobuf.Any proto_payload = 2;</code>
 */
public com.google.protobuf.Any getProtoPayload() {
 if (protoPayloadBuilder_ == null) {
  if (payloadCase_ == 2) {
   return (com.google.protobuf.Any) payload_;
  }
  return com.google.protobuf.Any.getDefaultInstance();
 } else {
  if (payloadCase_ == 2) {
   return protoPayloadBuilder_.getMessage();
  }
  return com.google.protobuf.Any.getDefaultInstance();
 }
}
/**

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

/**
 *
 *
 * <pre>
 * The log entry payload, represented as a protocol buffer.  Some
 * Google Cloud Platform services use this field for their log
 * entry payloads.
 * </pre>
 *
 * <code>.google.protobuf.Any proto_payload = 2;</code>
 */
public com.google.protobuf.AnyOrBuilder getProtoPayloadOrBuilder() {
 if ((payloadCase_ == 2) && (protoPayloadBuilder_ != null)) {
  return protoPayloadBuilder_.getMessageOrBuilder();
 } else {
  if (payloadCase_ == 2) {
   return (com.google.protobuf.Any) payload_;
  }
  return com.google.protobuf.Any.getDefaultInstance();
 }
}
/**

代码示例来源:origin: com.google.protobuf/protobuf-java

/**
 * <pre>
 * Must be a valid serialized protocol buffer of the above specified type.
 * </pre>
 *
 * <code>bytes value = 2;</code>
 */
public Builder clearValue() {
 
 value_ = getDefaultInstance().getValue();
 onChanged();
 return this;
}
@java.lang.Override

代码示例来源:origin: com.google.protobuf/protobuf-java

typeUrl_ = getDefaultInstance().getTypeUrl();
onChanged();
return this;

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

if (protoPayloadBuilder_ == null) {
 if (!(payloadCase_ == 2)) {
  payload_ = com.google.protobuf.Any.getDefaultInstance();

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

if (payloadCase_ == 2 && payload_ != com.google.protobuf.Any.getDefaultInstance()) {
 payload_ =
   com.google.protobuf.Any.newBuilder((com.google.protobuf.Any) payload_)

代码示例来源:origin: com.google.protobuf/protobuf-java

public Builder mergeFrom(com.google.protobuf.Any other) {
 if (other == com.google.protobuf.Any.getDefaultInstance()) return this;
 if (!other.getTypeUrl().isEmpty()) {
  typeUrl_ = other.typeUrl_;
  onChanged();
 }
 if (other.getValue() != com.google.protobuf.ByteString.EMPTY) {
  setValue(other.getValue());
 }
 this.mergeUnknownFields(other.unknownFields);
 onChanged();
 return this;
}

代码示例来源:origin: com.athaydes.protobuf/protobuf-tcp-rpc

/**
 * <code>optional .google.protobuf.Any successResult = 1;</code>
 */
public com.google.protobuf.AnyOrBuilder getSuccessResultOrBuilder() {
 if (resultCase_ == 1) {
   return (com.google.protobuf.Any) result_;
 }
 return com.google.protobuf.Any.getDefaultInstance();
}

代码示例来源:origin: envoyproxy/java-control-plane

/**
 * <code>.google.protobuf.Any typed_config = 4;</code>
 */
public com.google.protobuf.AnyOrBuilder getTypedConfigOrBuilder() {
 if (configTypeCase_ == 4) {
   return (com.google.protobuf.Any) configType_;
 }
 return com.google.protobuf.Any.getDefaultInstance();
}

代码示例来源:origin: envoyproxy/java-control-plane

/**
 * <code>.google.protobuf.Any typed_config = 3;</code>
 */
public com.google.protobuf.AnyOrBuilder getTypedConfigOrBuilder() {
 if (configTypeCase_ == 3) {
   return (com.google.protobuf.Any) configType_;
 }
 return com.google.protobuf.Any.getDefaultInstance();
}

代码示例来源:origin: envoyproxy/java-control-plane

/**
 * <code>.google.protobuf.Any typed_config = 3;</code>
 */
public com.google.protobuf.Any getTypedConfig() {
 if (configTypeCase_ == 3) {
   return (com.google.protobuf.Any) configType_;
 }
 return com.google.protobuf.Any.getDefaultInstance();
}
/**

代码示例来源:origin: org.tensorflow/proto

/**
 * <code>repeated .google.protobuf.Any value = 1;</code>
 */
public com.google.protobuf.Any.Builder addValueBuilder() {
 return getValueFieldBuilder().addBuilder(
   com.google.protobuf.Any.getDefaultInstance());
}
/**

代码示例来源:origin: com.hubspot.jackson/jackson-datatype-protobuf

@Test
public void itSetsDurationWhenZeroInJson() throws IOException {
 String json = camelCase().writeValueAsString(defaultNode());
 HasAny message = camelCase().readValue(json, HasAny.class);
 assertThat(message.hasAny()).isTrue();
 assertThat(message.getAny()).isEqualTo(Any.getDefaultInstance());
}

代码示例来源:origin: com.hubspot.jackson/jackson-datatype-protobuf

@Test
public void itWritesZeroWhenSetToDefaultInstanceWithDefaultInclusion() throws IOException {
 HasAny message = HasAny.newBuilder().setAny(Any.getDefaultInstance()).build();
 String json = camelCase().writeValueAsString(message);
 assertThat(camelCase().readTree(json)).isEqualTo(defaultNode());
}

相关文章