PageRenderTime 50ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/netty-protobuf-rpc/src/main/java/com/googlecode/protobuf/netty/NettyRpcProto.java

http://netty-protobuf-rpc.googlecode.com/
Java | 1013 lines | 882 code | 87 blank | 44 comment | 84 complexity | c9f9ab72825dd3c4aa7301c4f2eee6f3 MD5 | raw file
  1. /*
  2. * Copyright (c) 2009 Stephen Tu <stephen_tu@berkeley.edu>
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. * THE SOFTWARE.
  21. */
  22. // Generated by the protocol buffer compiler. DO NOT EDIT!
  23. package com.googlecode.protobuf.netty;
  24. public final class NettyRpcProto {
  25. private NettyRpcProto() {}
  26. public static void registerAllExtensions(
  27. com.google.protobuf.ExtensionRegistry registry) {
  28. }
  29. public enum ErrorCode
  30. implements com.google.protobuf.ProtocolMessageEnum {
  31. BAD_REQUEST_DATA(0, 0),
  32. BAD_REQUEST_PROTO(1, 1),
  33. SERVICE_NOT_FOUND(2, 2),
  34. METHOD_NOT_FOUND(3, 3),
  35. RPC_ERROR(4, 4),
  36. RPC_FAILED(5, 5),
  37. INVALID_REQUEST_PROTO(6, 6),
  38. BAD_RESPONSE_PROTO(7, 7),
  39. UNKNOWN_HOST(8, 8),
  40. IO_ERROR(9, 9),
  41. ;
  42. public final int getNumber() { return value; }
  43. public static ErrorCode valueOf(int value) {
  44. switch (value) {
  45. case 0: return BAD_REQUEST_DATA;
  46. case 1: return BAD_REQUEST_PROTO;
  47. case 2: return SERVICE_NOT_FOUND;
  48. case 3: return METHOD_NOT_FOUND;
  49. case 4: return RPC_ERROR;
  50. case 5: return RPC_FAILED;
  51. case 6: return INVALID_REQUEST_PROTO;
  52. case 7: return BAD_RESPONSE_PROTO;
  53. case 8: return UNKNOWN_HOST;
  54. case 9: return IO_ERROR;
  55. default: return null;
  56. }
  57. }
  58. public static com.google.protobuf.Internal.EnumLiteMap<ErrorCode>
  59. internalGetValueMap() {
  60. return internalValueMap;
  61. }
  62. private static com.google.protobuf.Internal.EnumLiteMap<ErrorCode>
  63. internalValueMap =
  64. new com.google.protobuf.Internal.EnumLiteMap<ErrorCode>() {
  65. public ErrorCode findValueByNumber(int number) {
  66. return ErrorCode.valueOf(number)
  67. ; }
  68. };
  69. public final com.google.protobuf.Descriptors.EnumValueDescriptor
  70. getValueDescriptor() {
  71. return getDescriptor().getValues().get(index);
  72. }
  73. public final com.google.protobuf.Descriptors.EnumDescriptor
  74. getDescriptorForType() {
  75. return getDescriptor();
  76. }
  77. public static final com.google.protobuf.Descriptors.EnumDescriptor
  78. getDescriptor() {
  79. return com.googlecode.protobuf.netty.NettyRpcProto.getDescriptor().getEnumTypes().get(0);
  80. }
  81. private static final ErrorCode[] VALUES = {
  82. 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,
  83. };
  84. public static ErrorCode valueOf(
  85. com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
  86. if (desc.getType() != getDescriptor()) {
  87. throw new java.lang.IllegalArgumentException(
  88. "EnumValueDescriptor is not for this type.");
  89. }
  90. return VALUES[desc.getIndex()];
  91. }
  92. private final int index;
  93. private final int value;
  94. private ErrorCode(int index, int value) {
  95. this.index = index;
  96. this.value = value;
  97. }
  98. static {
  99. com.googlecode.protobuf.netty.NettyRpcProto.getDescriptor();
  100. }
  101. }
  102. public static final class RpcRequest extends
  103. com.google.protobuf.GeneratedMessage {
  104. // Use RpcRequest.newBuilder() to construct.
  105. private RpcRequest() {}
  106. private static final RpcRequest defaultInstance = new RpcRequest();
  107. public static RpcRequest getDefaultInstance() {
  108. return defaultInstance;
  109. }
  110. public RpcRequest getDefaultInstanceForType() {
  111. return defaultInstance;
  112. }
  113. public static final com.google.protobuf.Descriptors.Descriptor
  114. getDescriptor() {
  115. return com.googlecode.protobuf.netty.NettyRpcProto.internal_static_RpcRequest_descriptor;
  116. }
  117. protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
  118. internalGetFieldAccessorTable() {
  119. return com.googlecode.protobuf.netty.NettyRpcProto.internal_static_RpcRequest_fieldAccessorTable;
  120. }
  121. // optional int32 id = 1;
  122. public static final int ID_FIELD_NUMBER = 1;
  123. private boolean hasId;
  124. private int id_ = 0;
  125. public boolean hasId() { return hasId; }
  126. public int getId() { return id_; }
  127. // required string service_name = 2;
  128. public static final int SERVICE_NAME_FIELD_NUMBER = 2;
  129. private boolean hasServiceName;
  130. private java.lang.String serviceName_ = "";
  131. public boolean hasServiceName() { return hasServiceName; }
  132. public java.lang.String getServiceName() { return serviceName_; }
  133. // required string method_name = 3;
  134. public static final int METHOD_NAME_FIELD_NUMBER = 3;
  135. private boolean hasMethodName;
  136. private java.lang.String methodName_ = "";
  137. public boolean hasMethodName() { return hasMethodName; }
  138. public java.lang.String getMethodName() { return methodName_; }
  139. // required bool is_blocking_service = 4;
  140. public static final int IS_BLOCKING_SERVICE_FIELD_NUMBER = 4;
  141. private boolean hasIsBlockingService;
  142. private boolean isBlockingService_ = false;
  143. public boolean hasIsBlockingService() { return hasIsBlockingService; }
  144. public boolean getIsBlockingService() { return isBlockingService_; }
  145. // required bytes request_message = 5;
  146. public static final int REQUEST_MESSAGE_FIELD_NUMBER = 5;
  147. private boolean hasRequestMessage;
  148. private com.google.protobuf.ByteString requestMessage_ = com.google.protobuf.ByteString.EMPTY;
  149. public boolean hasRequestMessage() { return hasRequestMessage; }
  150. public com.google.protobuf.ByteString getRequestMessage() { return requestMessage_; }
  151. public final boolean isInitialized() {
  152. if (!hasServiceName) return false;
  153. if (!hasMethodName) return false;
  154. if (!hasIsBlockingService) return false;
  155. if (!hasRequestMessage) return false;
  156. return true;
  157. }
  158. public void writeTo(com.google.protobuf.CodedOutputStream output)
  159. throws java.io.IOException {
  160. if (hasId()) {
  161. output.writeInt32(1, getId());
  162. }
  163. if (hasServiceName()) {
  164. output.writeString(2, getServiceName());
  165. }
  166. if (hasMethodName()) {
  167. output.writeString(3, getMethodName());
  168. }
  169. if (hasIsBlockingService()) {
  170. output.writeBool(4, getIsBlockingService());
  171. }
  172. if (hasRequestMessage()) {
  173. output.writeBytes(5, getRequestMessage());
  174. }
  175. getUnknownFields().writeTo(output);
  176. }
  177. private int memoizedSerializedSize = -1;
  178. public int getSerializedSize() {
  179. int size = memoizedSerializedSize;
  180. if (size != -1) return size;
  181. size = 0;
  182. if (hasId()) {
  183. size += com.google.protobuf.CodedOutputStream
  184. .computeInt32Size(1, getId());
  185. }
  186. if (hasServiceName()) {
  187. size += com.google.protobuf.CodedOutputStream
  188. .computeStringSize(2, getServiceName());
  189. }
  190. if (hasMethodName()) {
  191. size += com.google.protobuf.CodedOutputStream
  192. .computeStringSize(3, getMethodName());
  193. }
  194. if (hasIsBlockingService()) {
  195. size += com.google.protobuf.CodedOutputStream
  196. .computeBoolSize(4, getIsBlockingService());
  197. }
  198. if (hasRequestMessage()) {
  199. size += com.google.protobuf.CodedOutputStream
  200. .computeBytesSize(5, getRequestMessage());
  201. }
  202. size += getUnknownFields().getSerializedSize();
  203. memoizedSerializedSize = size;
  204. return size;
  205. }
  206. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(
  207. com.google.protobuf.ByteString data)
  208. throws com.google.protobuf.InvalidProtocolBufferException {
  209. return newBuilder().mergeFrom(data).buildParsed();
  210. }
  211. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(
  212. com.google.protobuf.ByteString data,
  213. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  214. throws com.google.protobuf.InvalidProtocolBufferException {
  215. return newBuilder().mergeFrom(data, extensionRegistry)
  216. .buildParsed();
  217. }
  218. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(byte[] data)
  219. throws com.google.protobuf.InvalidProtocolBufferException {
  220. return newBuilder().mergeFrom(data).buildParsed();
  221. }
  222. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(
  223. byte[] data,
  224. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  225. throws com.google.protobuf.InvalidProtocolBufferException {
  226. return newBuilder().mergeFrom(data, extensionRegistry)
  227. .buildParsed();
  228. }
  229. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(java.io.InputStream input)
  230. throws java.io.IOException {
  231. return newBuilder().mergeFrom(input).buildParsed();
  232. }
  233. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(
  234. java.io.InputStream input,
  235. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  236. throws java.io.IOException {
  237. return newBuilder().mergeFrom(input, extensionRegistry)
  238. .buildParsed();
  239. }
  240. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseDelimitedFrom(java.io.InputStream input)
  241. throws java.io.IOException {
  242. return newBuilder().mergeDelimitedFrom(input).buildParsed();
  243. }
  244. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseDelimitedFrom(
  245. java.io.InputStream input,
  246. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  247. throws java.io.IOException {
  248. return newBuilder().mergeDelimitedFrom(input, extensionRegistry)
  249. .buildParsed();
  250. }
  251. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(
  252. com.google.protobuf.CodedInputStream input)
  253. throws java.io.IOException {
  254. return newBuilder().mergeFrom(input).buildParsed();
  255. }
  256. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest parseFrom(
  257. com.google.protobuf.CodedInputStream input,
  258. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  259. throws java.io.IOException {
  260. return newBuilder().mergeFrom(input, extensionRegistry)
  261. .buildParsed();
  262. }
  263. public static Builder newBuilder() { return Builder.create(); }
  264. public Builder newBuilderForType() { return newBuilder(); }
  265. public static Builder newBuilder(com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest prototype) {
  266. return newBuilder().mergeFrom(prototype);
  267. }
  268. public Builder toBuilder() { return newBuilder(this); }
  269. public static final class Builder extends
  270. com.google.protobuf.GeneratedMessage.Builder<Builder> {
  271. private com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest result;
  272. // Construct using com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest.newBuilder()
  273. private Builder() {}
  274. private static Builder create() {
  275. Builder builder = new Builder();
  276. builder.result = new com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest();
  277. return builder;
  278. }
  279. protected com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest internalGetResult() {
  280. return result;
  281. }
  282. public Builder clear() {
  283. if (result == null) {
  284. throw new IllegalStateException(
  285. "Cannot call clear() after build().");
  286. }
  287. result = new com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest();
  288. return this;
  289. }
  290. public Builder clone() {
  291. return create().mergeFrom(result);
  292. }
  293. public com.google.protobuf.Descriptors.Descriptor
  294. getDescriptorForType() {
  295. return com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest.getDescriptor();
  296. }
  297. public com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest getDefaultInstanceForType() {
  298. return com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest.getDefaultInstance();
  299. }
  300. public boolean isInitialized() {
  301. return result.isInitialized();
  302. }
  303. public com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest build() {
  304. if (result != null && !isInitialized()) {
  305. throw newUninitializedMessageException(result);
  306. }
  307. return buildPartial();
  308. }
  309. private com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest buildParsed()
  310. throws com.google.protobuf.InvalidProtocolBufferException {
  311. if (!isInitialized()) {
  312. throw newUninitializedMessageException(
  313. result).asInvalidProtocolBufferException();
  314. }
  315. return buildPartial();
  316. }
  317. public com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest buildPartial() {
  318. if (result == null) {
  319. throw new IllegalStateException(
  320. "build() has already been called on this Builder.");
  321. }
  322. com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest returnMe = result;
  323. result = null;
  324. return returnMe;
  325. }
  326. public Builder mergeFrom(com.google.protobuf.Message other) {
  327. if (other instanceof com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest) {
  328. return mergeFrom((com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest)other);
  329. } else {
  330. super.mergeFrom(other);
  331. return this;
  332. }
  333. }
  334. public Builder mergeFrom(com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest other) {
  335. if (other == com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest.getDefaultInstance()) return this;
  336. if (other.hasId()) {
  337. setId(other.getId());
  338. }
  339. if (other.hasServiceName()) {
  340. setServiceName(other.getServiceName());
  341. }
  342. if (other.hasMethodName()) {
  343. setMethodName(other.getMethodName());
  344. }
  345. if (other.hasIsBlockingService()) {
  346. setIsBlockingService(other.getIsBlockingService());
  347. }
  348. if (other.hasRequestMessage()) {
  349. setRequestMessage(other.getRequestMessage());
  350. }
  351. this.mergeUnknownFields(other.getUnknownFields());
  352. return this;
  353. }
  354. public Builder mergeFrom(
  355. com.google.protobuf.CodedInputStream input,
  356. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  357. throws java.io.IOException {
  358. com.google.protobuf.UnknownFieldSet.Builder unknownFields =
  359. com.google.protobuf.UnknownFieldSet.newBuilder(
  360. this.getUnknownFields());
  361. while (true) {
  362. int tag = input.readTag();
  363. switch (tag) {
  364. case 0:
  365. this.setUnknownFields(unknownFields.build());
  366. return this;
  367. default: {
  368. if (!parseUnknownField(input, unknownFields,
  369. extensionRegistry, tag)) {
  370. this.setUnknownFields(unknownFields.build());
  371. return this;
  372. }
  373. break;
  374. }
  375. case 8: {
  376. setId(input.readInt32());
  377. break;
  378. }
  379. case 18: {
  380. setServiceName(input.readString());
  381. break;
  382. }
  383. case 26: {
  384. setMethodName(input.readString());
  385. break;
  386. }
  387. case 32: {
  388. setIsBlockingService(input.readBool());
  389. break;
  390. }
  391. case 42: {
  392. setRequestMessage(input.readBytes());
  393. break;
  394. }
  395. }
  396. }
  397. }
  398. // optional int32 id = 1;
  399. public boolean hasId() {
  400. return result.hasId();
  401. }
  402. public int getId() {
  403. return result.getId();
  404. }
  405. public Builder setId(int value) {
  406. result.hasId = true;
  407. result.id_ = value;
  408. return this;
  409. }
  410. public Builder clearId() {
  411. result.hasId = false;
  412. result.id_ = 0;
  413. return this;
  414. }
  415. // required string service_name = 2;
  416. public boolean hasServiceName() {
  417. return result.hasServiceName();
  418. }
  419. public java.lang.String getServiceName() {
  420. return result.getServiceName();
  421. }
  422. public Builder setServiceName(java.lang.String value) {
  423. if (value == null) {
  424. throw new NullPointerException();
  425. }
  426. result.hasServiceName = true;
  427. result.serviceName_ = value;
  428. return this;
  429. }
  430. public Builder clearServiceName() {
  431. result.hasServiceName = false;
  432. result.serviceName_ = getDefaultInstance().getServiceName();
  433. return this;
  434. }
  435. // required string method_name = 3;
  436. public boolean hasMethodName() {
  437. return result.hasMethodName();
  438. }
  439. public java.lang.String getMethodName() {
  440. return result.getMethodName();
  441. }
  442. public Builder setMethodName(java.lang.String value) {
  443. if (value == null) {
  444. throw new NullPointerException();
  445. }
  446. result.hasMethodName = true;
  447. result.methodName_ = value;
  448. return this;
  449. }
  450. public Builder clearMethodName() {
  451. result.hasMethodName = false;
  452. result.methodName_ = getDefaultInstance().getMethodName();
  453. return this;
  454. }
  455. // required bool is_blocking_service = 4;
  456. public boolean hasIsBlockingService() {
  457. return result.hasIsBlockingService();
  458. }
  459. public boolean getIsBlockingService() {
  460. return result.getIsBlockingService();
  461. }
  462. public Builder setIsBlockingService(boolean value) {
  463. result.hasIsBlockingService = true;
  464. result.isBlockingService_ = value;
  465. return this;
  466. }
  467. public Builder clearIsBlockingService() {
  468. result.hasIsBlockingService = false;
  469. result.isBlockingService_ = false;
  470. return this;
  471. }
  472. // required bytes request_message = 5;
  473. public boolean hasRequestMessage() {
  474. return result.hasRequestMessage();
  475. }
  476. public com.google.protobuf.ByteString getRequestMessage() {
  477. return result.getRequestMessage();
  478. }
  479. public Builder setRequestMessage(com.google.protobuf.ByteString value) {
  480. if (value == null) {
  481. throw new NullPointerException();
  482. }
  483. result.hasRequestMessage = true;
  484. result.requestMessage_ = value;
  485. return this;
  486. }
  487. public Builder clearRequestMessage() {
  488. result.hasRequestMessage = false;
  489. result.requestMessage_ = getDefaultInstance().getRequestMessage();
  490. return this;
  491. }
  492. }
  493. static {
  494. com.googlecode.protobuf.netty.NettyRpcProto.getDescriptor();
  495. }
  496. static {
  497. com.googlecode.protobuf.netty.NettyRpcProto.internalForceInit();
  498. }
  499. }
  500. public static final class RpcResponse extends
  501. com.google.protobuf.GeneratedMessage {
  502. // Use RpcResponse.newBuilder() to construct.
  503. private RpcResponse() {}
  504. private static final RpcResponse defaultInstance = new RpcResponse();
  505. public static RpcResponse getDefaultInstance() {
  506. return defaultInstance;
  507. }
  508. public RpcResponse getDefaultInstanceForType() {
  509. return defaultInstance;
  510. }
  511. public static final com.google.protobuf.Descriptors.Descriptor
  512. getDescriptor() {
  513. return com.googlecode.protobuf.netty.NettyRpcProto.internal_static_RpcResponse_descriptor;
  514. }
  515. protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
  516. internalGetFieldAccessorTable() {
  517. return com.googlecode.protobuf.netty.NettyRpcProto.internal_static_RpcResponse_fieldAccessorTable;
  518. }
  519. // required int32 id = 1;
  520. public static final int ID_FIELD_NUMBER = 1;
  521. private boolean hasId;
  522. private int id_ = 0;
  523. public boolean hasId() { return hasId; }
  524. public int getId() { return id_; }
  525. // optional bytes response_message = 2;
  526. public static final int RESPONSE_MESSAGE_FIELD_NUMBER = 2;
  527. private boolean hasResponseMessage;
  528. private com.google.protobuf.ByteString responseMessage_ = com.google.protobuf.ByteString.EMPTY;
  529. public boolean hasResponseMessage() { return hasResponseMessage; }
  530. public com.google.protobuf.ByteString getResponseMessage() { return responseMessage_; }
  531. // optional .ErrorCode error_code = 3;
  532. public static final int ERROR_CODE_FIELD_NUMBER = 3;
  533. private boolean hasErrorCode;
  534. private com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode errorCode_ = com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode.BAD_REQUEST_DATA;
  535. public boolean hasErrorCode() { return hasErrorCode; }
  536. public com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode getErrorCode() { return errorCode_; }
  537. // optional string error_message = 4;
  538. public static final int ERROR_MESSAGE_FIELD_NUMBER = 4;
  539. private boolean hasErrorMessage;
  540. private java.lang.String errorMessage_ = "";
  541. public boolean hasErrorMessage() { return hasErrorMessage; }
  542. public java.lang.String getErrorMessage() { return errorMessage_; }
  543. public final boolean isInitialized() {
  544. if (!hasId) return false;
  545. return true;
  546. }
  547. public void writeTo(com.google.protobuf.CodedOutputStream output)
  548. throws java.io.IOException {
  549. if (hasId()) {
  550. output.writeInt32(1, getId());
  551. }
  552. if (hasResponseMessage()) {
  553. output.writeBytes(2, getResponseMessage());
  554. }
  555. if (hasErrorCode()) {
  556. output.writeEnum(3, getErrorCode().getNumber());
  557. }
  558. if (hasErrorMessage()) {
  559. output.writeString(4, getErrorMessage());
  560. }
  561. getUnknownFields().writeTo(output);
  562. }
  563. private int memoizedSerializedSize = -1;
  564. public int getSerializedSize() {
  565. int size = memoizedSerializedSize;
  566. if (size != -1) return size;
  567. size = 0;
  568. if (hasId()) {
  569. size += com.google.protobuf.CodedOutputStream
  570. .computeInt32Size(1, getId());
  571. }
  572. if (hasResponseMessage()) {
  573. size += com.google.protobuf.CodedOutputStream
  574. .computeBytesSize(2, getResponseMessage());
  575. }
  576. if (hasErrorCode()) {
  577. size += com.google.protobuf.CodedOutputStream
  578. .computeEnumSize(3, getErrorCode().getNumber());
  579. }
  580. if (hasErrorMessage()) {
  581. size += com.google.protobuf.CodedOutputStream
  582. .computeStringSize(4, getErrorMessage());
  583. }
  584. size += getUnknownFields().getSerializedSize();
  585. memoizedSerializedSize = size;
  586. return size;
  587. }
  588. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(
  589. com.google.protobuf.ByteString data)
  590. throws com.google.protobuf.InvalidProtocolBufferException {
  591. return newBuilder().mergeFrom(data).buildParsed();
  592. }
  593. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(
  594. com.google.protobuf.ByteString data,
  595. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  596. throws com.google.protobuf.InvalidProtocolBufferException {
  597. return newBuilder().mergeFrom(data, extensionRegistry)
  598. .buildParsed();
  599. }
  600. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(byte[] data)
  601. throws com.google.protobuf.InvalidProtocolBufferException {
  602. return newBuilder().mergeFrom(data).buildParsed();
  603. }
  604. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(
  605. byte[] data,
  606. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  607. throws com.google.protobuf.InvalidProtocolBufferException {
  608. return newBuilder().mergeFrom(data, extensionRegistry)
  609. .buildParsed();
  610. }
  611. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(java.io.InputStream input)
  612. throws java.io.IOException {
  613. return newBuilder().mergeFrom(input).buildParsed();
  614. }
  615. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(
  616. java.io.InputStream input,
  617. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  618. throws java.io.IOException {
  619. return newBuilder().mergeFrom(input, extensionRegistry)
  620. .buildParsed();
  621. }
  622. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseDelimitedFrom(java.io.InputStream input)
  623. throws java.io.IOException {
  624. return newBuilder().mergeDelimitedFrom(input).buildParsed();
  625. }
  626. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseDelimitedFrom(
  627. java.io.InputStream input,
  628. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  629. throws java.io.IOException {
  630. return newBuilder().mergeDelimitedFrom(input, extensionRegistry)
  631. .buildParsed();
  632. }
  633. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(
  634. com.google.protobuf.CodedInputStream input)
  635. throws java.io.IOException {
  636. return newBuilder().mergeFrom(input).buildParsed();
  637. }
  638. public static com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse parseFrom(
  639. com.google.protobuf.CodedInputStream input,
  640. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  641. throws java.io.IOException {
  642. return newBuilder().mergeFrom(input, extensionRegistry)
  643. .buildParsed();
  644. }
  645. public static Builder newBuilder() { return Builder.create(); }
  646. public Builder newBuilderForType() { return newBuilder(); }
  647. public static Builder newBuilder(com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse prototype) {
  648. return newBuilder().mergeFrom(prototype);
  649. }
  650. public Builder toBuilder() { return newBuilder(this); }
  651. public static final class Builder extends
  652. com.google.protobuf.GeneratedMessage.Builder<Builder> {
  653. private com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse result;
  654. // Construct using com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse.newBuilder()
  655. private Builder() {}
  656. private static Builder create() {
  657. Builder builder = new Builder();
  658. builder.result = new com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse();
  659. return builder;
  660. }
  661. protected com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse internalGetResult() {
  662. return result;
  663. }
  664. public Builder clear() {
  665. if (result == null) {
  666. throw new IllegalStateException(
  667. "Cannot call clear() after build().");
  668. }
  669. result = new com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse();
  670. return this;
  671. }
  672. public Builder clone() {
  673. return create().mergeFrom(result);
  674. }
  675. public com.google.protobuf.Descriptors.Descriptor
  676. getDescriptorForType() {
  677. return com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse.getDescriptor();
  678. }
  679. public com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse getDefaultInstanceForType() {
  680. return com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse.getDefaultInstance();
  681. }
  682. public boolean isInitialized() {
  683. return result.isInitialized();
  684. }
  685. public com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse build() {
  686. if (result != null && !isInitialized()) {
  687. throw newUninitializedMessageException(result);
  688. }
  689. return buildPartial();
  690. }
  691. private com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse buildParsed()
  692. throws com.google.protobuf.InvalidProtocolBufferException {
  693. if (!isInitialized()) {
  694. throw newUninitializedMessageException(
  695. result).asInvalidProtocolBufferException();
  696. }
  697. return buildPartial();
  698. }
  699. public com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse buildPartial() {
  700. if (result == null) {
  701. throw new IllegalStateException(
  702. "build() has already been called on this Builder.");
  703. }
  704. com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse returnMe = result;
  705. result = null;
  706. return returnMe;
  707. }
  708. public Builder mergeFrom(com.google.protobuf.Message other) {
  709. if (other instanceof com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse) {
  710. return mergeFrom((com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse)other);
  711. } else {
  712. super.mergeFrom(other);
  713. return this;
  714. }
  715. }
  716. public Builder mergeFrom(com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse other) {
  717. if (other == com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse.getDefaultInstance()) return this;
  718. if (other.hasId()) {
  719. setId(other.getId());
  720. }
  721. if (other.hasResponseMessage()) {
  722. setResponseMessage(other.getResponseMessage());
  723. }
  724. if (other.hasErrorCode()) {
  725. setErrorCode(other.getErrorCode());
  726. }
  727. if (other.hasErrorMessage()) {
  728. setErrorMessage(other.getErrorMessage());
  729. }
  730. this.mergeUnknownFields(other.getUnknownFields());
  731. return this;
  732. }
  733. public Builder mergeFrom(
  734. com.google.protobuf.CodedInputStream input,
  735. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  736. throws java.io.IOException {
  737. com.google.protobuf.UnknownFieldSet.Builder unknownFields =
  738. com.google.protobuf.UnknownFieldSet.newBuilder(
  739. this.getUnknownFields());
  740. while (true) {
  741. int tag = input.readTag();
  742. switch (tag) {
  743. case 0:
  744. this.setUnknownFields(unknownFields.build());
  745. return this;
  746. default: {
  747. if (!parseUnknownField(input, unknownFields,
  748. extensionRegistry, tag)) {
  749. this.setUnknownFields(unknownFields.build());
  750. return this;
  751. }
  752. break;
  753. }
  754. case 8: {
  755. setId(input.readInt32());
  756. break;
  757. }
  758. case 18: {
  759. setResponseMessage(input.readBytes());
  760. break;
  761. }
  762. case 24: {
  763. int rawValue = input.readEnum();
  764. com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode value = com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode.valueOf(rawValue);
  765. if (value == null) {
  766. unknownFields.mergeVarintField(3, rawValue);
  767. } else {
  768. setErrorCode(value);
  769. }
  770. break;
  771. }
  772. case 34: {
  773. setErrorMessage(input.readString());
  774. break;
  775. }
  776. }
  777. }
  778. }
  779. // required int32 id = 1;
  780. public boolean hasId() {
  781. return result.hasId();
  782. }
  783. public int getId() {
  784. return result.getId();
  785. }
  786. public Builder setId(int value) {
  787. result.hasId = true;
  788. result.id_ = value;
  789. return this;
  790. }
  791. public Builder clearId() {
  792. result.hasId = false;
  793. result.id_ = 0;
  794. return this;
  795. }
  796. // optional bytes response_message = 2;
  797. public boolean hasResponseMessage() {
  798. return result.hasResponseMessage();
  799. }
  800. public com.google.protobuf.ByteString getResponseMessage() {
  801. return result.getResponseMessage();
  802. }
  803. public Builder setResponseMessage(com.google.protobuf.ByteString value) {
  804. if (value == null) {
  805. throw new NullPointerException();
  806. }
  807. result.hasResponseMessage = true;
  808. result.responseMessage_ = value;
  809. return this;
  810. }
  811. public Builder clearResponseMessage() {
  812. result.hasResponseMessage = false;
  813. result.responseMessage_ = getDefaultInstance().getResponseMessage();
  814. return this;
  815. }
  816. // optional .ErrorCode error_code = 3;
  817. public boolean hasErrorCode() {
  818. return result.hasErrorCode();
  819. }
  820. public com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode getErrorCode() {
  821. return result.getErrorCode();
  822. }
  823. public Builder setErrorCode(com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode value) {
  824. if (value == null) {
  825. throw new NullPointerException();
  826. }
  827. result.hasErrorCode = true;
  828. result.errorCode_ = value;
  829. return this;
  830. }
  831. public Builder clearErrorCode() {
  832. result.hasErrorCode = false;
  833. result.errorCode_ = com.googlecode.protobuf.netty.NettyRpcProto.ErrorCode.BAD_REQUEST_DATA;
  834. return this;
  835. }
  836. // optional string error_message = 4;
  837. public boolean hasErrorMessage() {
  838. return result.hasErrorMessage();
  839. }
  840. public java.lang.String getErrorMessage() {
  841. return result.getErrorMessage();
  842. }
  843. public Builder setErrorMessage(java.lang.String value) {
  844. if (value == null) {
  845. throw new NullPointerException();
  846. }
  847. result.hasErrorMessage = true;
  848. result.errorMessage_ = value;
  849. return this;
  850. }
  851. public Builder clearErrorMessage() {
  852. result.hasErrorMessage = false;
  853. result.errorMessage_ = getDefaultInstance().getErrorMessage();
  854. return this;
  855. }
  856. }
  857. static {
  858. com.googlecode.protobuf.netty.NettyRpcProto.getDescriptor();
  859. }
  860. static {
  861. com.googlecode.protobuf.netty.NettyRpcProto.internalForceInit();
  862. }
  863. }
  864. private static com.google.protobuf.Descriptors.Descriptor
  865. internal_static_RpcRequest_descriptor;
  866. private static
  867. com.google.protobuf.GeneratedMessage.FieldAccessorTable
  868. internal_static_RpcRequest_fieldAccessorTable;
  869. private static com.google.protobuf.Descriptors.Descriptor
  870. internal_static_RpcResponse_descriptor;
  871. private static
  872. com.google.protobuf.GeneratedMessage.FieldAccessorTable
  873. internal_static_RpcResponse_fieldAccessorTable;
  874. public static com.google.protobuf.Descriptors.FileDescriptor
  875. getDescriptor() {
  876. return descriptor;
  877. }
  878. private static com.google.protobuf.Descriptors.FileDescriptor
  879. descriptor;
  880. static {
  881. java.lang.String[] descriptorData = {
  882. "\n\016nettyrpc.proto\"y\n\nRpcRequest\022\n\n\002id\030\001 \001" +
  883. "(\005\022\024\n\014service_name\030\002 \002(\t\022\023\n\013method_name\030" +
  884. "\003 \002(\t\022\033\n\023is_blocking_service\030\004 \002(\010\022\027\n\017re" +
  885. "quest_message\030\005 \002(\014\"j\n\013RpcResponse\022\n\n\002id" +
  886. "\030\001 \002(\005\022\030\n\020response_message\030\002 \001(\014\022\036\n\nerro" +
  887. "r_code\030\003 \001(\0162\n.ErrorCode\022\025\n\rerror_messag" +
  888. "e\030\004 \001(\t*\327\001\n\tErrorCode\022\024\n\020BAD_REQUEST_DAT" +
  889. "A\020\000\022\025\n\021BAD_REQUEST_PROTO\020\001\022\025\n\021SERVICE_NO" +
  890. "T_FOUND\020\002\022\024\n\020METHOD_NOT_FOUND\020\003\022\r\n\tRPC_E" +
  891. "RROR\020\004\022\016\n\nRPC_FAILED\020\005\022\031\n\025INVALID_REQUES",
  892. "T_PROTO\020\006\022\026\n\022BAD_RESPONSE_PROTO\020\007\022\020\n\014UNK" +
  893. "NOWN_HOST\020\010\022\014\n\010IO_ERROR\020\tB0\n\035com.googlec" +
  894. "ode.protobuf.nettyB\rNettyRpcProtoH\001"
  895. };
  896. com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
  897. new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
  898. public com.google.protobuf.ExtensionRegistry assignDescriptors(
  899. com.google.protobuf.Descriptors.FileDescriptor root) {
  900. descriptor = root;
  901. internal_static_RpcRequest_descriptor =
  902. getDescriptor().getMessageTypes().get(0);
  903. internal_static_RpcRequest_fieldAccessorTable = new
  904. com.google.protobuf.GeneratedMessage.FieldAccessorTable(
  905. internal_static_RpcRequest_descriptor,
  906. new java.lang.String[] { "Id", "ServiceName", "MethodName", "IsBlockingService", "RequestMessage", },
  907. com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest.class,
  908. com.googlecode.protobuf.netty.NettyRpcProto.RpcRequest.Builder.class);
  909. internal_static_RpcResponse_descriptor =
  910. getDescriptor().getMessageTypes().get(1);
  911. internal_static_RpcResponse_fieldAccessorTable = new
  912. com.google.protobuf.GeneratedMessage.FieldAccessorTable(
  913. internal_static_RpcResponse_descriptor,
  914. new java.lang.String[] { "Id", "ResponseMessage", "ErrorCode", "ErrorMessage", },
  915. com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse.class,
  916. com.googlecode.protobuf.netty.NettyRpcProto.RpcResponse.Builder.class);
  917. return null;
  918. }
  919. };
  920. com.google.protobuf.Descriptors.FileDescriptor
  921. .internalBuildGeneratedFileFrom(descriptorData,
  922. new com.google.protobuf.Descriptors.FileDescriptor[] {
  923. }, assigner);
  924. }
  925. public static void internalForceInit() {}
  926. }