本文整理了Java中com.google.protobuf.Message.getDefaultInstanceForType()
方法的一些代码示例,展示了Message.getDefaultInstanceForType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getDefaultInstanceForType()
方法的具体详情如下:
包路径:com.google.protobuf.Message
类名称:Message
方法名:getDefaultInstanceForType
暂无
代码示例来源:origin: google/truth
private static Message orDefaultForType(
@NullableDecl Message input, @NullableDecl Message other) {
return (input != null) ? input : other.getDefaultInstanceForType();
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
private Message getReturnMessage(final Method method,
final RpcWritable.Buffer buf) throws ServiceException {
Message prototype = null;
try {
prototype = getReturnProtoType(method);
} catch (Exception e) {
throw new ServiceException(e);
}
Message returnMessage;
try {
returnMessage = buf.getValue(prototype.getDefaultInstanceForType());
if (LOG.isTraceEnabled()) {
LOG.trace(Thread.currentThread().getId() + ": Response <- " +
remoteId + ": " + method.getName() +
" {" + TextFormat.shortDebugString(returnMessage) + "}");
}
} catch (Throwable e) {
throw new ServiceException(e);
}
return returnMessage;
}
代码示例来源:origin: apache/hbase
public static Message getResponse(
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.CoprocessorServiceResponse
result,
com.google.protobuf.Message responsePrototype)
throws IOException {
Message response;
if (result.getValue().hasValue()) {
Message.Builder builder = responsePrototype.newBuilderForType();
builder.mergeFrom(result.getValue().getValue().newInput());
response = builder.build();
} else {
response = responsePrototype.getDefaultInstanceForType();
}
if (LOG.isTraceEnabled()) {
LOG.trace("Master Result is value=" + response);
}
return response;
}
代码示例来源:origin: com.google.protobuf/protobuf-java
if (existingValue == existingValue.getDefaultInstanceForType()) {
setField(field, entry.getValue());
} else {
代码示例来源:origin: line/armeria
private Message deserializeProto(ByteBuf buf, Message prototype) throws IOException {
if (GrpcSerializationFormats.isProto(serializationFormat)) {
if (!buf.isReadable()) {
return prototype.getDefaultInstanceForType();
代码示例来源:origin: osmandapp/Osmand
if (existingValue == existingValue.getDefaultInstanceForType()) {
setField(field, entry.getValue());
} else {
代码示例来源:origin: google/truth
actualFields.get(fieldDescriptor),
expectedFields.get(fieldDescriptor),
actual.getDefaultInstanceForType().getField(fieldDescriptor),
shouldCompare == FieldScopeResult.EXCLUDED_NONRECURSIVELY,
fieldDescriptor,
代码示例来源:origin: google/bundletool
private boolean isDefaultTargeting(T splittingDimensionTargeting) {
return splittingDimensionTargeting.equals(
splittingDimensionTargeting.getDefaultInstanceForType());
}
代码示例来源:origin: org.apache.hbase/hbase-client
public static Message getResponse(
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.CoprocessorServiceResponse
result,
com.google.protobuf.Message responsePrototype)
throws IOException {
Message response;
if (result.getValue().hasValue()) {
Message.Builder builder = responsePrototype.newBuilderForType();
builder.mergeFrom(result.getValue().getValue().newInput());
response = builder.build();
} else {
response = responsePrototype.getDefaultInstanceForType();
}
if (LOG.isTraceEnabled()) {
LOG.trace("Master Result is value=" + response);
}
return response;
}
代码示例来源:origin: com.google.truth.extensions/truth-proto-extension
private static Message orDefaultForType(
@NullableDecl Message input, @NullableDecl Message other) {
return (input != null) ? input : other.getDefaultInstanceForType();
}
代码示例来源:origin: io.hops/hadoop-common
private Message getReturnMessage(final Method method,
final RpcWritable.Buffer buf) throws ServiceException {
Message prototype = null;
try {
prototype = getReturnProtoType(method);
} catch (Exception e) {
throw new ServiceException(e);
}
Message returnMessage;
try {
returnMessage = buf.getValue(prototype.getDefaultInstanceForType());
if (LOG.isTraceEnabled()) {
LOG.trace(Thread.currentThread().getId() + ": Response <- " +
remoteId + ": " + method.getName() +
" {" + TextFormat.shortDebugString(returnMessage) + "}");
}
} catch (Throwable e) {
throw new ServiceException(e);
}
return returnMessage;
}
代码示例来源:origin: com.github.protobufel/protobufel
/**
* Merges the field from another field.
*
* @param value the value to merge from
* @return the builder
*/
public SingleFieldBuilder<MType, BType, IType> mergeFrom(final MType value) {
if (builder == null && message == message.getDefaultInstanceForType()) {
message = value;
} else {
getBuilder().mergeFrom(value);
}
onChanged();
return this;
}
代码示例来源:origin: com.google.openrtb/openrtb-core
} else {
@SuppressWarnings("unchecked")
M ret = (M) msg.getDefaultInstanceForType();
return ret;
代码示例来源:origin: com.github.protobufel/protobufel
/**
* Clears the value of the field.
*
* @return the builder
*/
@Override
@SuppressWarnings("unchecked")
public void clear() {
message =
(MType) (message != null ? message.getDefaultInstanceForType() : builder
.getDefaultInstanceForType());
if (builder != null) {
dispose(builder);
builder = null;
}
onChanged();
}
代码示例来源:origin: com.aliyun.hbase/alihbase-client
public static Message getResponse(
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.CoprocessorServiceResponse
result,
com.google.protobuf.Message responsePrototype)
throws IOException {
Message response;
if (result.getValue().hasValue()) {
Message.Builder builder = responsePrototype.newBuilderForType();
builder.mergeFrom(result.getValue().getValue().newInput());
response = builder.build();
} else {
response = responsePrototype.getDefaultInstanceForType();
}
if (LOG.isTraceEnabled()) {
LOG.trace("Master Result is value=" + response);
}
return response;
}
代码示例来源:origin: WeAreFairphone/FP2-Launcher
if (existingValue == existingValue.getDefaultInstanceForType()) {
setField(field, entry.getValue());
} else {
代码示例来源:origin: yeriomin/play-store-api
if (existingValue == existingValue.getDefaultInstanceForType()) {
setField(field, entry.getValue());
} else {
代码示例来源:origin: com.linecorp.armeria/armeria-grpc
private Message deserializeProto(ByteBuf buf, Message prototype) throws IOException {
if (GrpcSerializationFormats.isProto(serializationFormat)) {
if (!buf.isReadable()) {
return prototype.getDefaultInstanceForType();
代码示例来源:origin: blueapron/kafka-connect-protobuf-converter
if (message == message.getDefaultInstanceForType()) {
return null;
代码示例来源:origin: com.google.truth.extensions/truth-proto-extension
actualFields.get(fieldDescriptor),
expectedFields.get(fieldDescriptor),
actual.getDefaultInstanceForType().getField(fieldDescriptor),
shouldIgnore.shouldIgnoreNonRecursive(),
fieldDescriptor,
内容来源于网络,如有侵权,请联系作者删除!