/** * <code>string message = 1;</code> */ public Builder clearMessage() { message_ = getDefaultInstance().getMessage(); onChanged(); return this; } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + MESSAGE_FIELD_NUMBER; hash = (53 * hash) + getMessage().hashCode(); hash = (37 * hash) + FROM_FIELD_NUMBER; hash = (53 * hash) + getFrom().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getMessageBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, message_); } if (!getFromBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, from_); } unknownFields.writeTo(output); }
/** * <code>string from = 2;</code> */ public Builder clearFrom() { from_ = getDefaultInstance().getFrom(); onChanged(); return this; } /**
public Builder mergeFrom(com.example.grpc.EchoResponse other) { if (other == com.example.grpc.EchoResponse.getDefaultInstance()) return this; if (!other.getMessage().isEmpty()) { message_ = other.message_; onChanged(); } if (!other.getFrom().isEmpty()) { from_ = other.from_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.example.grpc.EchoResponse)) { return super.equals(obj); } com.example.grpc.EchoResponse other = (com.example.grpc.EchoResponse) obj; boolean result = true; result = result && getMessage() .equals(other.getMessage()); result = result && getFrom() .equals(other.getFrom()); result = result && unknownFields.equals(other.unknownFields); return result; }
break; default: { if (!parseUnknownFieldProto3( input, unknownFields, extensionRegistry, tag)) { done = true; } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable();
public com.example.grpc.EchoResponse getDefaultInstanceForType() { return com.example.grpc.EchoResponse.getDefaultInstance(); }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {
public com.example.grpc.EchoResponse buildPartial() { com.example.grpc.EchoResponse result = new com.example.grpc.EchoResponse(this); result.message_ = message_; result.from_ = from_; onBuilt(); return result; }
public com.example.grpc.EchoResponse build() { com.example.grpc.EchoResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
private static io.grpc.MethodDescriptor<com.example.grpc.EchoRequest, com.example.grpc.EchoResponse> getEchoMethodHelper() { io.grpc.MethodDescriptor<com.example.grpc.EchoRequest, com.example.grpc.EchoResponse> getEchoMethod; if ((getEchoMethod = EchoServiceGrpc.getEchoMethod) == null) { synchronized (EchoServiceGrpc.class) { if ((getEchoMethod = EchoServiceGrpc.getEchoMethod) == null) { EchoServiceGrpc.getEchoMethod = getEchoMethod = io.grpc.MethodDescriptor.<com.example.grpc.EchoRequest, com.example.grpc.EchoResponse>newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setFullMethodName(generateFullMethodName( "com.example.grpc.EchoService", "echo")) .setSampledToLocalTracing(true) .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( com.example.grpc.EchoRequest.getDefaultInstance())) .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( com.example.grpc.EchoResponse.getDefaultInstance())) .setSchemaDescriptor(new EchoServiceMethodDescriptorSupplier("echo")) .build(); } } } return getEchoMethod; }
@Override public void echo(EchoRequest request, StreamObserver<EchoResponse> responseObserver) { try { String from = InetAddress.getLocalHost().getHostAddress(); System.out.println("Received: " + request.getMessage()); responseObserver.onNext(EchoResponse.newBuilder() .setFrom(from) .setMessage(request.getMessage()) .build()); responseObserver.onCompleted(); } catch (UnknownHostException e) { responseObserver.onError(e); } } }
public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getMessageBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, message_); } if (!getFromBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, from_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }