/netty-protobuf-rpc/src/main/java/com/googlecode/protobuf/netty/NettyRpcProto.java
Java | 1013 lines | 882 code | 87 blank | 44 comment | 84 complexity | c9f9ab72825dd3c4aa7301c4f2eee6f3 MD5 | raw file
- /*
- * Copyright (c) 2009 Stephen Tu <stephen_tu@berkeley.edu>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
- // Generated by the protocol buffer compiler. DO NOT EDIT!
- package com.googlecode.protobuf.netty;
- public final class NettyRpcProto {
- private NettyRpcProto() {}
- public static void registerAllExtensions(
- com.google.protobuf.ExtensionRegistry registry) {
- }
- public enum ErrorCode
- implements com.google.protobuf.ProtocolMessageEnum {
- BAD_REQUEST_DATA(0, 0),
- BAD_REQUEST_PROTO(1, 1),
- SERVICE_NOT_FOUND(2, 2),
- METHOD_NOT_FOUND(3, 3),
- RPC_ERROR(4, 4),
- RPC_FAILED(5, 5),
- INVALID_REQUEST_PROTO(6, 6),
- BAD_RESPONSE_PROTO(7, 7),
- UNKNOWN_HOST(8, 8),
- IO_ERROR(9, 9),
- ;
-
-
- public final int getNumber() { return value; }
-
- public static ErrorCode valueOf(int value) {
- switch (value) {
- case 0: return BAD_REQUEST_DATA;
- case 1: return BAD_REQUEST_PROTO;
- case 2: return SERVICE_NOT_FOUND;
- case 3: return METHOD_NOT_FOUND;
- case 4: return RPC_ERROR;
- case 5: return RPC_FAILED;
- case 6: return INVALID_REQUEST_PROTO;
- case 7: return BAD_RESPONSE_PROTO;
- case 8: return UNKNOWN_HOST;
- case 9: return IO_ERROR;
- default: return null;
- }
- }
-
- public static com.google.protobuf.Internal.EnumLiteMap<ErrorCode>
- internalGetValueMap() {
- return internalValueMap;
- }
- private static com.google.protobuf.Internal.EnumLiteMap<ErrorCode>
- internalValueMap =
- new com.google.protobuf.Internal.EnumLiteMap<ErrorCode>() {
- public ErrorCode findValueByNumber(int number) {
- return ErrorCode.valueOf(number)
- ; }
- };
-
- public final com.google.protobuf.Descriptors.EnumValueDescriptor
- getValueDescriptor() {
- return getDescriptor().getValues().get(index);
- }
- public final com.google.protobuf.Descriptors.EnumDescriptor
- getDescriptorForType() {
- return getDescriptor();
- }
- public static final com.google.protobuf.Descriptors.EnumDescriptor
- getDescriptor() {
- return com.googlecode.protobuf.netty.NettyRpcProto.getDescriptor().getEnumTypes().get(0);
- }
-
- private static final ErrorCode[] VALUES = {
- BAD_REQUEST_DATA, BAD_REQUEST_PROTO, SERVICE_NOT_FOUND, METHOD_NOT_FOUND, RPC_ERROR, RPC_FAILED, INVALID_REQUEST_PROTO, BAD_RESPONSE_PROTO, UNKNOWN_HOST, IO_ERROR,
- };
- public static ErrorCode valueOf(
- com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
- if (desc.getType() != getDescriptor()) {
- throw new java.lang.IllegalArgumentException(
- "EnumValueDescriptor is not for this type.");
- }
- return VALUES[desc.getIndex()];
- }
- private final int index;
- private final int value;
- private ErrorCode(int index, int value) {
- this.index = index;
- this.value = value;
- }
-
- static {
- com.googlecode.protobuf.netty.NettyRpcProto.getDescriptor();
- }
- }
-
- public static final class RpcRequest extends
- com.google.protobuf.GeneratedMessage {
- // Use RpcRequest.newBuilder() to construct.
- private RpcRequest() {}
-
- private static final RpcRequest defaultInstance = new RpcRequest();
- public static RpcRequest getDefaultInstance() {
- return defaultInstance;
- }
-
- public RpcRequest getDefaultInstanceForType() {
- return defaultInstance;
- }
-
- public static final com.google.protobuf.Descriptors.Descriptor
- getDescriptor() {
- return com.googlecode.protobuf.netty.NettyRpcProto.internal_static_RpcRequest_descriptor;
- }
-
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
- internalGetFieldAccessorTable() {
- return com.googlecode.protobuf.netty.NettyRpcProto.internal_static_RpcRequest_fieldAccessorTable;
- }
-
- // optional int32 id = 1;
- public static final int ID_FIELD_NUMBER = 1;
- private boolean hasId;
- private int id_ = 0;
- public boolean hasId() { return hasId; }
- public int getId() { return id_; }
-
- // required string service_name = 2;
- public static final int SERVICE_NAME_FIELD_NUMBER = 2;
- private boolean hasServiceName;
- private java.lang.String serviceName_ = "";
- public boolean hasServiceName() { return hasServiceName; }
- public java.lang.String getServiceName() { return serviceName_; }
-
- // required string method_name = 3;
- public static final int METHOD_NAME_FIELD_NUMBER = 3;
- private boolean hasMethodName;
- private java.lang.String methodName_ = "";
- public boolean hasMethodName() { return hasMethodName; }
- public java.lang.String getMethodName() { return methodName_; }
-
- // required bool is_blocking_service = 4;
- public static final int IS_BLOCKING_SERVICE_FIELD_NUMBER = 4;
- private boolean hasIsBlockingService;
- private boolean isBlockingService_ = false;
- public boolean hasIsBlockingService() { return hasIsBlockingService; }
- public boolean getIsBlockingService() { return isBlockingService_; }
-
- // required bytes request_message = 5;
- public static final int REQUEST_MESSAGE_FIELD_NUMBER = 5;
- private boolean hasRequestMessage;
- private com.google.protobuf.ByteString requestMessage_ = com.google.protobuf.ByteString.EMPTY;
- public boolean hasRequestMessage() { return hasRequestMessage; }
- public com.google.protobuf.ByteString getRequestMessage() { return requestMessage_; }
-
- public final boolean isInitialized() {
- if (!hasServiceName) return false;
- if (!hasMethodName) return false;
- if (!hasIsBlockingService) return false;
- if (!hasRequestMessage) return false;
- return true;
- }
-
- public void writeTo(com.google.protobuf.CodedOutputStream output)
- throws java.io.IOException {
- if (hasId()) {
- output.writeInt32(1, getId());
- }
- if (hasServiceName()) {
- output.writeString(2, getServiceName());
- }
- if (hasMethodName()) {
- output.writeString(3, getMethodName());
- }
- if (hasIsBlockingService()) {
- output.writeBool(4, getIsBlockingService());
- }
- if (hasRequestMessage()) {
- output.writeBytes(5, getRequestMessage());
- }
- getUnknownFields().writeTo(output);
- }
-
- private int memoizedSerializedSize = -1;
- public int getSerializedSize() {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
-
- size = 0;
- if (hasId()) {
- size += com.google.protobuf.CodedOutputStream
- .computeInt32Size(1, getId());
- }
- if (hasServiceName()) {
- size += com.google.protobuf.CodedOutputStream
- .computeStringSize(2, getServiceName());
- }
- if (hasMethodName()) {
- size += com.google.protobuf.CodedOutputStream
- .computeStringSize(3, getMethodName());
- }
- if (hasIsBlockingService()) {
- size += com.google.protobuf.CodedOutputStream
- .computeBoolSize(4, getIsBlockingService());
- }
- if (hasRequestMessage()) {
- size += com.google.protobuf.CodedOutputStream
- .computeBytesSize(5, getRequestMessage());
- }
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
- return size;
- }
-
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(
- com.google.protobuf.ByteString data)
- throws com.google.protobuf.InvalidProtocolBufferException {
- return newBuilder().mergeFrom(data).buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(
- com.google.protobuf.ByteString data,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws com.google.protobuf.InvalidProtocolBufferException {
- return newBuilder().mergeFrom(data, extensionRegistry)
- .buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(byte[] data)
- throws com.google.protobuf.InvalidProtocolBufferException {
- return newBuilder().mergeFrom(data).buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(
- byte[] data,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws com.google.protobuf.InvalidProtocolBufferException {
- return newBuilder().mergeFrom(data, extensionRegistry)
- .buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(java.io.InputStream input)
- throws java.io.IOException {
- return newBuilder().mergeFrom(input).buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(
- java.io.InputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return newBuilder().mergeFrom(input, extensionRegistry)
- .buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseDelimitedFrom(java.io.InputStream input)
- throws java.io.IOException {
- return newBuilder().mergeDelimitedFrom(input).buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseDelimitedFrom(
- java.io.InputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return newBuilder().mergeDelimitedFrom(input, extensionRegistry)
- .buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(
- com.google.protobuf.CodedInputStream input)
- throws java.io.IOException {
- return newBuilder().mergeFrom(input).buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(
- com.google.protobuf.CodedInputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return newBuilder().mergeFrom(input, extensionRegistry)
- .buildParsed();
- }
-
- public static Builder newBuilder() { return Builder.create(); }
- public Builder newBuilderForType() { return newBuilder(); }
- public static Builder newBuilder(com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest prototype) {
- return newBuilder().mergeFrom(prototype);
- }
- public Builder toBuilder() { return newBuilder(this); }
-
- public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builder<Builder> {
- private com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest result;
-
- // Construct using com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest.newBuilder()
- private Builder() {}
-
- private static Builder create() {
- Builder builder = new Builder();
- builder.result = new com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest();
- return builder;
- }
-
- protected com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest internalGetResult() {
- return result;
- }
-
- public Builder clear() {
- if (result == null) {
- throw new IllegalStateException(
- "Cannot call clear() after build().");
- }
- result = new com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest();
- return this;
- }
-
- public Builder clone() {
- return create().mergeFrom(result);
- }
-
- public com.google.protobuf.Descriptors.Descriptor
- getDescriptorForType() {
- return com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest.getDescriptor();
- }
-
- public com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest getDefaultInstanceForType() {
- return com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest.getDefaultInstance();
- }
-
- public boolean isInitialized() {
- return result.isInitialized();
- }
- public com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest build() {
- if (result != null && !isInitialized()) {
- throw newUninitializedMessageException(result);
- }
- return buildPartial();
- }
-
- private com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest buildParsed()
- throws com.google.protobuf.InvalidProtocolBufferException {
- if (!isInitialized()) {
- throw newUninitializedMessageException(
- result).asInvalidProtocolBufferException();
- }
- return buildPartial();
- }
-
- public com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest buildPartial() {
- if (result == null) {
- throw new IllegalStateException(
- "build() has already been called on this Builder.");
- }
- com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest returnMe = result;
- result = null;
- return returnMe;
- }
-
- public Builder mergeFrom(com.google.protobuf.Message other) {
- if (other instanceof com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest) {
- return mergeFrom((com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest)other);
- } else {
- super.mergeFrom(other);
- return this;
- }
- }
-
- public Builder mergeFrom(com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest other) {
- if (other == com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest.getDefaultInstance()) return this;
- if (other.hasId()) {
- setId(other.getId());
- }
- if (other.hasServiceName()) {
- setServiceName(other.getServiceName());
- }
- if (other.hasMethodName()) {
- setMethodName(other.getMethodName());
- }
- if (other.hasIsBlockingService()) {
- setIsBlockingService(other.getIsBlockingService());
- }
- if (other.hasRequestMessage()) {
- setRequestMessage(other.getRequestMessage());
- }
- this.mergeUnknownFields(other.getUnknownFields());
- return this;
- }
-
- public Builder mergeFrom(
- com.google.protobuf.CodedInputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- com.google.protobuf.UnknownFieldSet.Builder unknownFields =
- com.google.protobuf.UnknownFieldSet.newBuilder(
- this.getUnknownFields());
- while (true) {
- int tag = input.readTag();
- switch (tag) {
- case 0:
- this.setUnknownFields(unknownFields.build());
- return this;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- this.setUnknownFields(unknownFields.build());
- return this;
- }
- break;
- }
- case 8: {
- setId(input.readInt32());
- break;
- }
- case 18: {
- setServiceName(input.readString());
- break;
- }
- case 26: {
- setMethodName(input.readString());
- break;
- }
- case 32: {
- setIsBlockingService(input.readBool());
- break;
- }
- case 42: {
- setRequestMessage(input.readBytes());
- break;
- }
- }
- }
- }
-
-
- // optional int32 id = 1;
- public boolean hasId() {
- return result.hasId();
- }
- public int getId() {
- return result.getId();
- }
- public Builder setId(int value) {
- result.hasId = true;
- result.id_ = value;
- return this;
- }
- public Builder clearId() {
- result.hasId = false;
- result.id_ = 0;
- return this;
- }
-
- // required string service_name = 2;
- public boolean hasServiceName() {
- return result.hasServiceName();
- }
- public java.lang.String getServiceName() {
- return result.getServiceName();
- }
- public Builder setServiceName(java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- result.hasServiceName = true;
- result.serviceName_ = value;
- return this;
- }
- public Builder clearServiceName() {
- result.hasServiceName = false;
- result.serviceName_ = getDefaultInstance().getServiceName();
- return this;
- }
-
- // required string method_name = 3;
- public boolean hasMethodName() {
- return result.hasMethodName();
- }
- public java.lang.String getMethodName() {
- return result.getMethodName();
- }
- public Builder setMethodName(java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- result.hasMethodName = true;
- result.methodName_ = value;
- return this;
- }
- public Builder clearMethodName() {
- result.hasMethodName = false;
- result.methodName_ = getDefaultInstance().getMethodName();
- return this;
- }
-
- // required bool is_blocking_service = 4;
- public boolean hasIsBlockingService() {
- return result.hasIsBlockingService();
- }
- public boolean getIsBlockingService() {
- return result.getIsBlockingService();
- }
- public Builder setIsBlockingService(boolean value) {
- result.hasIsBlockingService = true;
- result.isBlockingService_ = value;
- return this;
- }
- public Builder clearIsBlockingService() {
- result.hasIsBlockingService = false;
- result.isBlockingService_ = false;
- return this;
- }
-
- // required bytes request_message = 5;
- public boolean hasRequestMessage() {
- return result.hasRequestMessage();
- }
- public com.google.protobuf.ByteString getRequestMessage() {
- return result.getRequestMessage();
- }
- public Builder setRequestMessage(com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- result.hasRequestMessage = true;
- result.requestMessage_ = value;
- return this;
- }
- public Builder clearRequestMessage() {
- result.hasRequestMessage = false;
- result.requestMessage_ = getDefaultInstance().getRequestMessage();
- return this;
- }
- }
-
- static {
- com.googlecode.protobuf.netty.NettyRpcProto.getDescriptor();
- }
-
- static {
- com.googlecode.protobuf.netty.NettyRpcProto.internalForceInit();
- }
- }
-
- public static final class RpcResponse extends
- com.google.protobuf.GeneratedMessage {
- // Use RpcResponse.newBuilder() to construct.
- private RpcResponse() {}
-
- private static final RpcResponse defaultInstance = new RpcResponse();
- public static RpcResponse getDefaultInstance() {
- return defaultInstance;
- }
-
- public RpcResponse getDefaultInstanceForType() {
- return defaultInstance;
- }
-
- public static final com.google.protobuf.Descriptors.Descriptor
- getDescriptor() {
- return com.googlecode.protobuf.netty.NettyRpcProto.internal_static_RpcResponse_descriptor;
- }
-
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
- internalGetFieldAccessorTable() {
- return com.googlecode.protobuf.netty.NettyRpcProto.internal_static_RpcResponse_fieldAccessorTable;
- }
-
- // required int32 id = 1;
- public static final int ID_FIELD_NUMBER = 1;
- private boolean hasId;
- private int id_ = 0;
- public boolean hasId() { return hasId; }
- public int getId() { return id_; }
-
- // optional bytes response_message = 2;
- public static final int RESPONSE_MESSAGE_FIELD_NUMBER = 2;
- private boolean hasResponseMessage;
- private com.google.protobuf.ByteString responseMessage_ = com.google.protobuf.ByteString.EMPTY;
- public boolean hasResponseMessage() { return hasResponseMessage; }
- public com.google.protobuf.ByteString getResponseMessage() { return responseMessage_; }
-
- // optional .ErrorCode error_code = 3;
- public static final int ERROR_CODE_FIELD_NUMBER = 3;
- private boolean hasErrorCode;
- private com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode errorCode_ = com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode.BAD_REQUEST_DATA;
- public boolean hasErrorCode() { return hasErrorCode; }
- public com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode getErrorCode() { return errorCode_; }
-
- // optional string error_message = 4;
- public static final int ERROR_MESSAGE_FIELD_NUMBER = 4;
- private boolean hasErrorMessage;
- private java.lang.String errorMessage_ = "";
- public boolean hasErrorMessage() { return hasErrorMessage; }
- public java.lang.String getErrorMessage() { return errorMessage_; }
-
- public final boolean isInitialized() {
- if (!hasId) return false;
- return true;
- }
-
- public void writeTo(com.google.protobuf.CodedOutputStream output)
- throws java.io.IOException {
- if (hasId()) {
- output.writeInt32(1, getId());
- }
- if (hasResponseMessage()) {
- output.writeBytes(2, getResponseMessage());
- }
- if (hasErrorCode()) {
- output.writeEnum(3, getErrorCode().getNumber());
- }
- if (hasErrorMessage()) {
- output.writeString(4, getErrorMessage());
- }
- getUnknownFields().writeTo(output);
- }
-
- private int memoizedSerializedSize = -1;
- public int getSerializedSize() {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
-
- size = 0;
- if (hasId()) {
- size += com.google.protobuf.CodedOutputStream
- .computeInt32Size(1, getId());
- }
- if (hasResponseMessage()) {
- size += com.google.protobuf.CodedOutputStream
- .computeBytesSize(2, getResponseMessage());
- }
- if (hasErrorCode()) {
- size += com.google.protobuf.CodedOutputStream
- .computeEnumSize(3, getErrorCode().getNumber());
- }
- if (hasErrorMessage()) {
- size += com.google.protobuf.CodedOutputStream
- .computeStringSize(4, getErrorMessage());
- }
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
- return size;
- }
-
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(
- com.google.protobuf.ByteString data)
- throws com.google.protobuf.InvalidProtocolBufferException {
- return newBuilder().mergeFrom(data).buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(
- com.google.protobuf.ByteString data,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws com.google.protobuf.InvalidProtocolBufferException {
- return newBuilder().mergeFrom(data, extensionRegistry)
- .buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(byte[] data)
- throws com.google.protobuf.InvalidProtocolBufferException {
- return newBuilder().mergeFrom(data).buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(
- byte[] data,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws com.google.protobuf.InvalidProtocolBufferException {
- return newBuilder().mergeFrom(data, extensionRegistry)
- .buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(java.io.InputStream input)
- throws java.io.IOException {
- return newBuilder().mergeFrom(input).buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(
- java.io.InputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return newBuilder().mergeFrom(input, extensionRegistry)
- .buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseDelimitedFrom(java.io.InputStream input)
- throws java.io.IOException {
- return newBuilder().mergeDelimitedFrom(input).buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseDelimitedFrom(
- java.io.InputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return newBuilder().mergeDelimitedFrom(input, extensionRegistry)
- .buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(
- com.google.protobuf.CodedInputStream input)
- throws java.io.IOException {
- return newBuilder().mergeFrom(input).buildParsed();
- }
- public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(
- com.google.protobuf.CodedInputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return newBuilder().mergeFrom(input, extensionRegistry)
- .buildParsed();
- }
-
- public static Builder newBuilder() { return Builder.create(); }
- public Builder newBuilderForType() { return newBuilder(); }
- public static Builder newBuilder(com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse prototype) {
- return newBuilder().mergeFrom(prototype);
- }
- public Builder toBuilder() { return newBuilder(this); }
-
- public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builder<Builder> {
- private com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse result;
-
- // Construct using com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse.newBuilder()
- private Builder() {}
-
- private static Builder create() {
- Builder builder = new Builder();
- builder.result = new com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse();
- return builder;
- }
-
- protected com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse internalGetResult() {
- return result;
- }
-
- public Builder clear() {
- if (result == null) {
- throw new IllegalStateException(
- "Cannot call clear() after build().");
- }
- result = new com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse();
- return this;
- }
-
- public Builder clone() {
- return create().mergeFrom(result);
- }
-
- public com.google.protobuf.Descriptors.Descriptor
- getDescriptorForType() {
- return com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse.getDescriptor();
- }
-
- public com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse getDefaultInstanceForType() {
- return com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse.getDefaultInstance();
- }
-
- public boolean isInitialized() {
- return result.isInitialized();
- }
- public com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse build() {
- if (result != null && !isInitialized()) {
- throw newUninitializedMessageException(result);
- }
- return buildPartial();
- }
-
- private com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse buildParsed()
- throws com.google.protobuf.InvalidProtocolBufferException {
- if (!isInitialized()) {
- throw newUninitializedMessageException(
- result).asInvalidProtocolBufferException();
- }
- return buildPartial();
- }
-
- public com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse buildPartial() {
- if (result == null) {
- throw new IllegalStateException(
- "build() has already been called on this Builder.");
- }
- com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse returnMe = result;
- result = null;
- return returnMe;
- }
-
- public Builder mergeFrom(com.google.protobuf.Message other) {
- if (other instanceof com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse) {
- return mergeFrom((com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse)other);
- } else {
- super.mergeFrom(other);
- return this;
- }
- }
-
- public Builder mergeFrom(com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse other) {
- if (other == com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse.getDefaultInstance()) return this;
- if (other.hasId()) {
- setId(other.getId());
- }
- if (other.hasResponseMessage()) {
- setResponseMessage(other.getResponseMessage());
- }
- if (other.hasErrorCode()) {
- setErrorCode(other.getErrorCode());
- }
- if (other.hasErrorMessage()) {
- setErrorMessage(other.getErrorMessage());
- }
- this.mergeUnknownFields(other.getUnknownFields());
- return this;
- }
-
- public Builder mergeFrom(
- com.google.protobuf.CodedInputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- com.google.protobuf.UnknownFieldSet.Builder unknownFields =
- com.google.protobuf.UnknownFieldSet.newBuilder(
- this.getUnknownFields());
- while (true) {
- int tag = input.readTag();
- switch (tag) {
- case 0:
- this.setUnknownFields(unknownFields.build());
- return this;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- this.setUnknownFields(unknownFields.build());
- return this;
- }
- break;
- }
- case 8: {
- setId(input.readInt32());
- break;
- }
- case 18: {
- setResponseMessage(input.readBytes());
- break;
- }
- case 24: {
- int rawValue = input.readEnum();
- com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode value = com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode.valueOf(rawValue);
- if (value == null) {
- unknownFields.mergeVarintField(3, rawValue);
- } else {
- setErrorCode(value);
- }
- break;
- }
- case 34: {
- setErrorMessage(input.readString());
- break;
- }
- }
- }
- }
-
-
- // required int32 id = 1;
- public boolean hasId() {
- return result.hasId();
- }
- public int getId() {
- return result.getId();
- }
- public Builder setId(int value) {
- result.hasId = true;
- result.id_ = value;
- return this;
- }
- public Builder clearId() {
- result.hasId = false;
- result.id_ = 0;
- return this;
- }
-
- // optional bytes response_message = 2;
- public boolean hasResponseMessage() {
- return result.hasResponseMessage();
- }
- public com.google.protobuf.ByteString getResponseMessage() {
- return result.getResponseMessage();
- }
- public Builder setResponseMessage(com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- result.hasResponseMessage = true;
- result.responseMessage_ = value;
- return this;
- }
- public Builder clearResponseMessage() {
- result.hasResponseMessage = false;
- result.responseMessage_ = getDefaultInstance().getResponseMessage();
- return this;
- }
-
- // optional .ErrorCode error_code = 3;
- public boolean hasErrorCode() {
- return result.hasErrorCode();
- }
- public com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode getErrorCode() {
- return result.getErrorCode();
- }
- public Builder setErrorCode(com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode value) {
- if (value == null) {
- throw new NullPointerException();
- }
- result.hasErrorCode = true;
- result.errorCode_ = value;
- return this;
- }
- public Builder clearErrorCode() {
- result.hasErrorCode = false;
- result.errorCode_ = com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode.BAD_REQUEST_DATA;
- return this;
- }
-
- // optional string error_message = 4;
- public boolean hasErrorMessage() {
- return result.hasErrorMessage();
- }
- public java.lang.String getErrorMessage() {
- return result.getErrorMessage();
- }
- public Builder setErrorMessage(java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- result.hasErrorMessage = true;
- result.errorMessage_ = value;
- return this;
- }
- public Builder clearErrorMessage() {
- result.hasErrorMessage = false;
- result.errorMessage_ = getDefaultInstance().getErrorMessage();
- return this;
- }
- }
-
- static {
- com.googlecode.protobuf.netty.NettyRpcProto.getDescriptor();
- }
-
- static {
- com.googlecode.protobuf.netty.NettyRpcProto.internalForceInit();
- }
- }
-
- private static com.google.protobuf.Descriptors.Descriptor
- internal_static_RpcRequest_descriptor;
- private static
- com.google.protobuf.GeneratedMessage.FieldAccessorTable
- internal_static_RpcRequest_fieldAccessorTable;
- private static com.google.protobuf.Descriptors.Descriptor
- internal_static_RpcResponse_descriptor;
- private static
- com.google.protobuf.GeneratedMessage.FieldAccessorTable
- internal_static_RpcResponse_fieldAccessorTable;
-
- public static com.google.protobuf.Descriptors.FileDescriptor
- getDescriptor() {
- return descriptor;
- }
- private static com.google.protobuf.Descriptors.FileDescriptor
- descriptor;
- static {
- java.lang.String[] descriptorData = {
- "\n\016nettyrpc.proto\"y\n\nRpcRequest\022\n\n\002id\030\001 \001" +
- "(\005\022\024\n\014service_name\030\002 \002(\t\022\023\n\013method_name\030" +
- "\003 \002(\t\022\033\n\023is_blocking_service\030\004 \002(\010\022\027\n\017re" +
- "quest_message\030\005 \002(\014\"j\n\013RpcResponse\022\n\n\002id" +
- "\030\001 \002(\005\022\030\n\020response_message\030\002 \001(\014\022\036\n\nerro" +
- "r_code\030\003 \001(\0162\n.ErrorCode\022\025\n\rerror_messag" +
- "e\030\004 \001(\t*\327\001\n\tErrorCode\022\024\n\020BAD_REQUEST_DAT" +
- "A\020\000\022\025\n\021BAD_REQUEST_PROTO\020\001\022\025\n\021SERVICE_NO" +
- "T_FOUND\020\002\022\024\n\020METHOD_NOT_FOUND\020\003\022\r\n\tRPC_E" +
- "RROR\020\004\022\016\n\nRPC_FAILED\020\005\022\031\n\025INVALID_REQUES",
- "T_PROTO\020\006\022\026\n\022BAD_RESPONSE_PROTO\020\007\022\020\n\014UNK" +
- "NOWN_HOST\020\010\022\014\n\010IO_ERROR\020\tB0\n\035com.googlec" +
- "ode.protobuf.nettyB\rNettyRpcProtoH\001"
- };
- com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
- new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
- public com.google.protobuf.ExtensionRegistry assignDescriptors(
- com.google.protobuf.Descriptors.FileDescriptor root) {
- descriptor = root;
- internal_static_RpcRequest_descriptor =
- getDescriptor().getMessageTypes().get(0);
- internal_static_RpcRequest_fieldAccessorTable = new
- com.google.protobuf.GeneratedMessage.FieldAccessorTable(
- internal_static_RpcRequest_descriptor,
- new java.lang.String[] { "Id", "ServiceName", "MethodName", "IsBlockingService", "RequestMessage", },
- com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest.class,
- com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest.Builder.class);
- internal_static_RpcResponse_descriptor =
- getDescriptor().getMessageTypes().get(1);
- internal_static_RpcResponse_fieldAccessorTable = new
- com.google.protobuf.GeneratedMessage.FieldAccessorTable(
- internal_static_RpcResponse_descriptor,
- new java.lang.String[] { "Id", "ResponseMessage", "ErrorCode", "ErrorMessage", },
- com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse.class,
- com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse.Builder.class);
- return null;
- }
- };
- com.google.protobuf.Descriptors.FileDescriptor
- .internalBuildGeneratedFileFrom(descriptorData,
- new com.google.protobuf.Descriptors.FileDescriptor[] {
- }, assigner);
- }
-
- public static void internalForceInit() {}
- }