PageRenderTime 29ms CodeModel.GetById 1ms RepoModel.GetById 1ms app.codeStats 0ms

/java/src/test/java/com/googlecode/protobuf/socketrpc/TestProtos.java

http://protobuf-socket-rpc.googlecode.com/
Java | 1130 lines | 985 code | 105 blank | 40 comment | 99 complexity | 11b5ccf6e70f077ddd859b6be60dc534 MD5 | raw file
  1. // Copyright (c) 2011 Shardul Deo
  2. //
  3. // Permission is hereby granted, free of charge, to any person obtaining a copy
  4. // of this software and associated documentation files (the "Software"), to deal
  5. // in the Software without restriction, including without limitation the rights
  6. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. // copies of the Software, and to permit persons to whom the Software is
  8. // furnished to do so, subject to the following conditions:
  9. //
  10. // The above copyright notice and this permission notice shall be included in
  11. // all copies or substantial portions of the Software.
  12. //
  13. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. // THE SOFTWARE.
  20. //
  21. // Generated by the protocol buffer compiler. DO NOT EDIT!
  22. // source: java/src/test/java/com/googlecode/protobuf/socketrpc/test.proto
  23. package com.googlecode.protobuf.socketrpc;
  24. public final class TestProtos {
  25. private TestProtos() {}
  26. public static void registerAllExtensions(
  27. com.google.protobuf.ExtensionRegistry registry) {
  28. }
  29. public interface RequestOrBuilder
  30. extends com.google.protobuf.MessageOrBuilder {
  31. // required string str_data = 1;
  32. boolean hasStrData();
  33. String getStrData();
  34. }
  35. public static final class Request extends
  36. com.google.protobuf.GeneratedMessage
  37. implements RequestOrBuilder {
  38. // Use Request.newBuilder() to construct.
  39. private Request(Builder builder) {
  40. super(builder);
  41. }
  42. private Request(boolean noInit) {}
  43. private static final Request defaultInstance;
  44. public static Request getDefaultInstance() {
  45. return defaultInstance;
  46. }
  47. public Request getDefaultInstanceForType() {
  48. return defaultInstance;
  49. }
  50. public static final com.google.protobuf.Descriptors.Descriptor
  51. getDescriptor() {
  52. return com.googlecode.protobuf.socketrpc.TestProtos.internal_static_protobuf_socketrpc_Request_descriptor;
  53. }
  54. protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
  55. internalGetFieldAccessorTable() {
  56. return com.googlecode.protobuf.socketrpc.TestProtos.internal_static_protobuf_socketrpc_Request_fieldAccessorTable;
  57. }
  58. private int bitField0_;
  59. // required string str_data = 1;
  60. public static final int STR_DATA_FIELD_NUMBER = 1;
  61. private Object strData_;
  62. public boolean hasStrData() {
  63. return ((bitField0_ & 0x00000001) == 0x00000001);
  64. }
  65. public String getStrData() {
  66. Object ref = strData_;
  67. if (ref instanceof String) {
  68. return (String) ref;
  69. } else {
  70. com.google.protobuf.ByteString bs =
  71. (com.google.protobuf.ByteString) ref;
  72. String s = bs.toStringUtf8();
  73. if (com.google.protobuf.Internal.isValidUtf8(bs)) {
  74. strData_ = s;
  75. }
  76. return s;
  77. }
  78. }
  79. private com.google.protobuf.ByteString getStrDataBytes() {
  80. Object ref = strData_;
  81. if (ref instanceof String) {
  82. com.google.protobuf.ByteString b =
  83. com.google.protobuf.ByteString.copyFromUtf8((String) ref);
  84. strData_ = b;
  85. return b;
  86. } else {
  87. return (com.google.protobuf.ByteString) ref;
  88. }
  89. }
  90. private void initFields() {
  91. strData_ = "";
  92. }
  93. private byte memoizedIsInitialized = -1;
  94. public final boolean isInitialized() {
  95. byte isInitialized = memoizedIsInitialized;
  96. if (isInitialized != -1) return isInitialized == 1;
  97. if (!hasStrData()) {
  98. memoizedIsInitialized = 0;
  99. return false;
  100. }
  101. memoizedIsInitialized = 1;
  102. return true;
  103. }
  104. public void writeTo(com.google.protobuf.CodedOutputStream output)
  105. throws java.io.IOException {
  106. getSerializedSize();
  107. if (((bitField0_ & 0x00000001) == 0x00000001)) {
  108. output.writeBytes(1, getStrDataBytes());
  109. }
  110. getUnknownFields().writeTo(output);
  111. }
  112. private int memoizedSerializedSize = -1;
  113. public int getSerializedSize() {
  114. int size = memoizedSerializedSize;
  115. if (size != -1) return size;
  116. size = 0;
  117. if (((bitField0_ & 0x00000001) == 0x00000001)) {
  118. size += com.google.protobuf.CodedOutputStream
  119. .computeBytesSize(1, getStrDataBytes());
  120. }
  121. size += getUnknownFields().getSerializedSize();
  122. memoizedSerializedSize = size;
  123. return size;
  124. }
  125. @java.lang.Override
  126. protected Object writeReplace() throws java.io.ObjectStreamException {
  127. return super.writeReplace();
  128. }
  129. public static com.googlecode.protobuf.socketrpc.TestProtos.Request parseFrom(
  130. com.google.protobuf.ByteString data)
  131. throws com.google.protobuf.InvalidProtocolBufferException {
  132. return newBuilder().mergeFrom(data).buildParsed();
  133. }
  134. public static com.googlecode.protobuf.socketrpc.TestProtos.Request parseFrom(
  135. com.google.protobuf.ByteString data,
  136. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  137. throws com.google.protobuf.InvalidProtocolBufferException {
  138. return newBuilder().mergeFrom(data, extensionRegistry)
  139. .buildParsed();
  140. }
  141. public static com.googlecode.protobuf.socketrpc.TestProtos.Request parseFrom(byte[] data)
  142. throws com.google.protobuf.InvalidProtocolBufferException {
  143. return newBuilder().mergeFrom(data).buildParsed();
  144. }
  145. public static com.googlecode.protobuf.socketrpc.TestProtos.Request parseFrom(
  146. byte[] data,
  147. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  148. throws com.google.protobuf.InvalidProtocolBufferException {
  149. return newBuilder().mergeFrom(data, extensionRegistry)
  150. .buildParsed();
  151. }
  152. public static com.googlecode.protobuf.socketrpc.TestProtos.Request parseFrom(java.io.InputStream input)
  153. throws java.io.IOException {
  154. return newBuilder().mergeFrom(input).buildParsed();
  155. }
  156. public static com.googlecode.protobuf.socketrpc.TestProtos.Request parseFrom(
  157. java.io.InputStream input,
  158. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  159. throws java.io.IOException {
  160. return newBuilder().mergeFrom(input, extensionRegistry)
  161. .buildParsed();
  162. }
  163. public static com.googlecode.protobuf.socketrpc.TestProtos.Request parseDelimitedFrom(java.io.InputStream input)
  164. throws java.io.IOException {
  165. Builder builder = newBuilder();
  166. if (builder.mergeDelimitedFrom(input)) {
  167. return builder.buildParsed();
  168. } else {
  169. return null;
  170. }
  171. }
  172. public static com.googlecode.protobuf.socketrpc.TestProtos.Request parseDelimitedFrom(
  173. java.io.InputStream input,
  174. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  175. throws java.io.IOException {
  176. Builder builder = newBuilder();
  177. if (builder.mergeDelimitedFrom(input, extensionRegistry)) {
  178. return builder.buildParsed();
  179. } else {
  180. return null;
  181. }
  182. }
  183. public static com.googlecode.protobuf.socketrpc.TestProtos.Request parseFrom(
  184. com.google.protobuf.CodedInputStream input)
  185. throws java.io.IOException {
  186. return newBuilder().mergeFrom(input).buildParsed();
  187. }
  188. public static com.googlecode.protobuf.socketrpc.TestProtos.Request parseFrom(
  189. com.google.protobuf.CodedInputStream input,
  190. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  191. throws java.io.IOException {
  192. return newBuilder().mergeFrom(input, extensionRegistry)
  193. .buildParsed();
  194. }
  195. public static Builder newBuilder() { return Builder.create(); }
  196. public Builder newBuilderForType() { return newBuilder(); }
  197. public static Builder newBuilder(com.googlecode.protobuf.socketrpc.TestProtos.Request prototype) {
  198. return newBuilder().mergeFrom(prototype);
  199. }
  200. public Builder toBuilder() { return newBuilder(this); }
  201. @java.lang.Override
  202. protected Builder newBuilderForType(
  203. com.google.protobuf.GeneratedMessage.BuilderParent parent) {
  204. Builder builder = new Builder(parent);
  205. return builder;
  206. }
  207. public static final class Builder extends
  208. com.google.protobuf.GeneratedMessage.Builder<Builder>
  209. implements com.googlecode.protobuf.socketrpc.TestProtos.RequestOrBuilder {
  210. public static final com.google.protobuf.Descriptors.Descriptor
  211. getDescriptor() {
  212. return com.googlecode.protobuf.socketrpc.TestProtos.internal_static_protobuf_socketrpc_Request_descriptor;
  213. }
  214. protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
  215. internalGetFieldAccessorTable() {
  216. return com.googlecode.protobuf.socketrpc.TestProtos.internal_static_protobuf_socketrpc_Request_fieldAccessorTable;
  217. }
  218. // Construct using com.googlecode.protobuf.socketrpc.TestProtos.Request.newBuilder()
  219. private Builder() {
  220. maybeForceBuilderInitialization();
  221. }
  222. private Builder(BuilderParent parent) {
  223. super(parent);
  224. maybeForceBuilderInitialization();
  225. }
  226. private void maybeForceBuilderInitialization() {
  227. if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
  228. }
  229. }
  230. private static Builder create() {
  231. return new Builder();
  232. }
  233. public Builder clear() {
  234. super.clear();
  235. strData_ = "";
  236. bitField0_ = (bitField0_ & ~0x00000001);
  237. return this;
  238. }
  239. public Builder clone() {
  240. return create().mergeFrom(buildPartial());
  241. }
  242. public com.google.protobuf.Descriptors.Descriptor
  243. getDescriptorForType() {
  244. return com.googlecode.protobuf.socketrpc.TestProtos.Request.getDescriptor();
  245. }
  246. public com.googlecode.protobuf.socketrpc.TestProtos.Request getDefaultInstanceForType() {
  247. return com.googlecode.protobuf.socketrpc.TestProtos.Request.getDefaultInstance();
  248. }
  249. public com.googlecode.protobuf.socketrpc.TestProtos.Request build() {
  250. com.googlecode.protobuf.socketrpc.TestProtos.Request result = buildPartial();
  251. if (!result.isInitialized()) {
  252. throw newUninitializedMessageException(result);
  253. }
  254. return result;
  255. }
  256. private com.googlecode.protobuf.socketrpc.TestProtos.Request buildParsed()
  257. throws com.google.protobuf.InvalidProtocolBufferException {
  258. com.googlecode.protobuf.socketrpc.TestProtos.Request result = buildPartial();
  259. if (!result.isInitialized()) {
  260. throw newUninitializedMessageException(
  261. result).asInvalidProtocolBufferException();
  262. }
  263. return result;
  264. }
  265. public com.googlecode.protobuf.socketrpc.TestProtos.Request buildPartial() {
  266. com.googlecode.protobuf.socketrpc.TestProtos.Request result = new com.googlecode.protobuf.socketrpc.TestProtos.Request(this);
  267. int from_bitField0_ = bitField0_;
  268. int to_bitField0_ = 0;
  269. if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
  270. to_bitField0_ |= 0x00000001;
  271. }
  272. result.strData_ = strData_;
  273. result.bitField0_ = to_bitField0_;
  274. onBuilt();
  275. return result;
  276. }
  277. public Builder mergeFrom(com.google.protobuf.Message other) {
  278. if (other instanceof com.googlecode.protobuf.socketrpc.TestProtos.Request) {
  279. return mergeFrom((com.googlecode.protobuf.socketrpc.TestProtos.Request)other);
  280. } else {
  281. super.mergeFrom(other);
  282. return this;
  283. }
  284. }
  285. public Builder mergeFrom(com.googlecode.protobuf.socketrpc.TestProtos.Request other) {
  286. if (other == com.googlecode.protobuf.socketrpc.TestProtos.Request.getDefaultInstance()) return this;
  287. if (other.hasStrData()) {
  288. setStrData(other.getStrData());
  289. }
  290. this.mergeUnknownFields(other.getUnknownFields());
  291. return this;
  292. }
  293. public final boolean isInitialized() {
  294. if (!hasStrData()) {
  295. return false;
  296. }
  297. return true;
  298. }
  299. public Builder mergeFrom(
  300. com.google.protobuf.CodedInputStream input,
  301. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  302. throws java.io.IOException {
  303. com.google.protobuf.UnknownFieldSet.Builder unknownFields =
  304. com.google.protobuf.UnknownFieldSet.newBuilder(
  305. this.getUnknownFields());
  306. while (true) {
  307. int tag = input.readTag();
  308. switch (tag) {
  309. case 0:
  310. this.setUnknownFields(unknownFields.build());
  311. onChanged();
  312. return this;
  313. default: {
  314. if (!parseUnknownField(input, unknownFields,
  315. extensionRegistry, tag)) {
  316. this.setUnknownFields(unknownFields.build());
  317. onChanged();
  318. return this;
  319. }
  320. break;
  321. }
  322. case 10: {
  323. bitField0_ |= 0x00000001;
  324. strData_ = input.readBytes();
  325. break;
  326. }
  327. }
  328. }
  329. }
  330. private int bitField0_;
  331. // required string str_data = 1;
  332. private Object strData_ = "";
  333. public boolean hasStrData() {
  334. return ((bitField0_ & 0x00000001) == 0x00000001);
  335. }
  336. public String getStrData() {
  337. Object ref = strData_;
  338. if (!(ref instanceof String)) {
  339. String s = ((com.google.protobuf.ByteString) ref).toStringUtf8();
  340. strData_ = s;
  341. return s;
  342. } else {
  343. return (String) ref;
  344. }
  345. }
  346. public Builder setStrData(String value) {
  347. if (value == null) {
  348. throw new NullPointerException();
  349. }
  350. bitField0_ |= 0x00000001;
  351. strData_ = value;
  352. onChanged();
  353. return this;
  354. }
  355. public Builder clearStrData() {
  356. bitField0_ = (bitField0_ & ~0x00000001);
  357. strData_ = getDefaultInstance().getStrData();
  358. onChanged();
  359. return this;
  360. }
  361. void setStrData(com.google.protobuf.ByteString value) {
  362. bitField0_ |= 0x00000001;
  363. strData_ = value;
  364. onChanged();
  365. }
  366. // @@protoc_insertion_point(builder_scope:protobuf.socketrpc.Request)
  367. }
  368. static {
  369. defaultInstance = new Request(true);
  370. defaultInstance.initFields();
  371. }
  372. // @@protoc_insertion_point(class_scope:protobuf.socketrpc.Request)
  373. }
  374. public interface ResponseOrBuilder
  375. extends com.google.protobuf.MessageOrBuilder {
  376. // required string str_data = 1;
  377. boolean hasStrData();
  378. String getStrData();
  379. // optional int32 int_data = 2;
  380. boolean hasIntData();
  381. int getIntData();
  382. }
  383. public static final class Response extends
  384. com.google.protobuf.GeneratedMessage
  385. implements ResponseOrBuilder {
  386. // Use Response.newBuilder() to construct.
  387. private Response(Builder builder) {
  388. super(builder);
  389. }
  390. private Response(boolean noInit) {}
  391. private static final Response defaultInstance;
  392. public static Response getDefaultInstance() {
  393. return defaultInstance;
  394. }
  395. public Response getDefaultInstanceForType() {
  396. return defaultInstance;
  397. }
  398. public static final com.google.protobuf.Descriptors.Descriptor
  399. getDescriptor() {
  400. return com.googlecode.protobuf.socketrpc.TestProtos.internal_static_protobuf_socketrpc_Response_descriptor;
  401. }
  402. protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
  403. internalGetFieldAccessorTable() {
  404. return com.googlecode.protobuf.socketrpc.TestProtos.internal_static_protobuf_socketrpc_Response_fieldAccessorTable;
  405. }
  406. private int bitField0_;
  407. // required string str_data = 1;
  408. public static final int STR_DATA_FIELD_NUMBER = 1;
  409. private Object strData_;
  410. public boolean hasStrData() {
  411. return ((bitField0_ & 0x00000001) == 0x00000001);
  412. }
  413. public String getStrData() {
  414. Object ref = strData_;
  415. if (ref instanceof String) {
  416. return (String) ref;
  417. } else {
  418. com.google.protobuf.ByteString bs =
  419. (com.google.protobuf.ByteString) ref;
  420. String s = bs.toStringUtf8();
  421. if (com.google.protobuf.Internal.isValidUtf8(bs)) {
  422. strData_ = s;
  423. }
  424. return s;
  425. }
  426. }
  427. private com.google.protobuf.ByteString getStrDataBytes() {
  428. Object ref = strData_;
  429. if (ref instanceof String) {
  430. com.google.protobuf.ByteString b =
  431. com.google.protobuf.ByteString.copyFromUtf8((String) ref);
  432. strData_ = b;
  433. return b;
  434. } else {
  435. return (com.google.protobuf.ByteString) ref;
  436. }
  437. }
  438. // optional int32 int_data = 2;
  439. public static final int INT_DATA_FIELD_NUMBER = 2;
  440. private int intData_;
  441. public boolean hasIntData() {
  442. return ((bitField0_ & 0x00000002) == 0x00000002);
  443. }
  444. public int getIntData() {
  445. return intData_;
  446. }
  447. private void initFields() {
  448. strData_ = "";
  449. intData_ = 0;
  450. }
  451. private byte memoizedIsInitialized = -1;
  452. public final boolean isInitialized() {
  453. byte isInitialized = memoizedIsInitialized;
  454. if (isInitialized != -1) return isInitialized == 1;
  455. if (!hasStrData()) {
  456. memoizedIsInitialized = 0;
  457. return false;
  458. }
  459. memoizedIsInitialized = 1;
  460. return true;
  461. }
  462. public void writeTo(com.google.protobuf.CodedOutputStream output)
  463. throws java.io.IOException {
  464. getSerializedSize();
  465. if (((bitField0_ & 0x00000001) == 0x00000001)) {
  466. output.writeBytes(1, getStrDataBytes());
  467. }
  468. if (((bitField0_ & 0x00000002) == 0x00000002)) {
  469. output.writeInt32(2, intData_);
  470. }
  471. getUnknownFields().writeTo(output);
  472. }
  473. private int memoizedSerializedSize = -1;
  474. public int getSerializedSize() {
  475. int size = memoizedSerializedSize;
  476. if (size != -1) return size;
  477. size = 0;
  478. if (((bitField0_ & 0x00000001) == 0x00000001)) {
  479. size += com.google.protobuf.CodedOutputStream
  480. .computeBytesSize(1, getStrDataBytes());
  481. }
  482. if (((bitField0_ & 0x00000002) == 0x00000002)) {
  483. size += com.google.protobuf.CodedOutputStream
  484. .computeInt32Size(2, intData_);
  485. }
  486. size += getUnknownFields().getSerializedSize();
  487. memoizedSerializedSize = size;
  488. return size;
  489. }
  490. @java.lang.Override
  491. protected Object writeReplace() throws java.io.ObjectStreamException {
  492. return super.writeReplace();
  493. }
  494. public static com.googlecode.protobuf.socketrpc.TestProtos.Response parseFrom(
  495. com.google.protobuf.ByteString data)
  496. throws com.google.protobuf.InvalidProtocolBufferException {
  497. return newBuilder().mergeFrom(data).buildParsed();
  498. }
  499. public static com.googlecode.protobuf.socketrpc.TestProtos.Response parseFrom(
  500. com.google.protobuf.ByteString data,
  501. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  502. throws com.google.protobuf.InvalidProtocolBufferException {
  503. return newBuilder().mergeFrom(data, extensionRegistry)
  504. .buildParsed();
  505. }
  506. public static com.googlecode.protobuf.socketrpc.TestProtos.Response parseFrom(byte[] data)
  507. throws com.google.protobuf.InvalidProtocolBufferException {
  508. return newBuilder().mergeFrom(data).buildParsed();
  509. }
  510. public static com.googlecode.protobuf.socketrpc.TestProtos.Response parseFrom(
  511. byte[] data,
  512. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  513. throws com.google.protobuf.InvalidProtocolBufferException {
  514. return newBuilder().mergeFrom(data, extensionRegistry)
  515. .buildParsed();
  516. }
  517. public static com.googlecode.protobuf.socketrpc.TestProtos.Response parseFrom(java.io.InputStream input)
  518. throws java.io.IOException {
  519. return newBuilder().mergeFrom(input).buildParsed();
  520. }
  521. public static com.googlecode.protobuf.socketrpc.TestProtos.Response parseFrom(
  522. java.io.InputStream input,
  523. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  524. throws java.io.IOException {
  525. return newBuilder().mergeFrom(input, extensionRegistry)
  526. .buildParsed();
  527. }
  528. public static com.googlecode.protobuf.socketrpc.TestProtos.Response parseDelimitedFrom(java.io.InputStream input)
  529. throws java.io.IOException {
  530. Builder builder = newBuilder();
  531. if (builder.mergeDelimitedFrom(input)) {
  532. return builder.buildParsed();
  533. } else {
  534. return null;
  535. }
  536. }
  537. public static com.googlecode.protobuf.socketrpc.TestProtos.Response parseDelimitedFrom(
  538. java.io.InputStream input,
  539. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  540. throws java.io.IOException {
  541. Builder builder = newBuilder();
  542. if (builder.mergeDelimitedFrom(input, extensionRegistry)) {
  543. return builder.buildParsed();
  544. } else {
  545. return null;
  546. }
  547. }
  548. public static com.googlecode.protobuf.socketrpc.TestProtos.Response parseFrom(
  549. com.google.protobuf.CodedInputStream input)
  550. throws java.io.IOException {
  551. return newBuilder().mergeFrom(input).buildParsed();
  552. }
  553. public static com.googlecode.protobuf.socketrpc.TestProtos.Response parseFrom(
  554. com.google.protobuf.CodedInputStream input,
  555. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  556. throws java.io.IOException {
  557. return newBuilder().mergeFrom(input, extensionRegistry)
  558. .buildParsed();
  559. }
  560. public static Builder newBuilder() { return Builder.create(); }
  561. public Builder newBuilderForType() { return newBuilder(); }
  562. public static Builder newBuilder(com.googlecode.protobuf.socketrpc.TestProtos.Response prototype) {
  563. return newBuilder().mergeFrom(prototype);
  564. }
  565. public Builder toBuilder() { return newBuilder(this); }
  566. @java.lang.Override
  567. protected Builder newBuilderForType(
  568. com.google.protobuf.GeneratedMessage.BuilderParent parent) {
  569. Builder builder = new Builder(parent);
  570. return builder;
  571. }
  572. public static final class Builder extends
  573. com.google.protobuf.GeneratedMessage.Builder<Builder>
  574. implements com.googlecode.protobuf.socketrpc.TestProtos.ResponseOrBuilder {
  575. public static final com.google.protobuf.Descriptors.Descriptor
  576. getDescriptor() {
  577. return com.googlecode.protobuf.socketrpc.TestProtos.internal_static_protobuf_socketrpc_Response_descriptor;
  578. }
  579. protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
  580. internalGetFieldAccessorTable() {
  581. return com.googlecode.protobuf.socketrpc.TestProtos.internal_static_protobuf_socketrpc_Response_fieldAccessorTable;
  582. }
  583. // Construct using com.googlecode.protobuf.socketrpc.TestProtos.Response.newBuilder()
  584. private Builder() {
  585. maybeForceBuilderInitialization();
  586. }
  587. private Builder(BuilderParent parent) {
  588. super(parent);
  589. maybeForceBuilderInitialization();
  590. }
  591. private void maybeForceBuilderInitialization() {
  592. if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
  593. }
  594. }
  595. private static Builder create() {
  596. return new Builder();
  597. }
  598. public Builder clear() {
  599. super.clear();
  600. strData_ = "";
  601. bitField0_ = (bitField0_ & ~0x00000001);
  602. intData_ = 0;
  603. bitField0_ = (bitField0_ & ~0x00000002);
  604. return this;
  605. }
  606. public Builder clone() {
  607. return create().mergeFrom(buildPartial());
  608. }
  609. public com.google.protobuf.Descriptors.Descriptor
  610. getDescriptorForType() {
  611. return com.googlecode.protobuf.socketrpc.TestProtos.Response.getDescriptor();
  612. }
  613. public com.googlecode.protobuf.socketrpc.TestProtos.Response getDefaultInstanceForType() {
  614. return com.googlecode.protobuf.socketrpc.TestProtos.Response.getDefaultInstance();
  615. }
  616. public com.googlecode.protobuf.socketrpc.TestProtos.Response build() {
  617. com.googlecode.protobuf.socketrpc.TestProtos.Response result = buildPartial();
  618. if (!result.isInitialized()) {
  619. throw newUninitializedMessageException(result);
  620. }
  621. return result;
  622. }
  623. private com.googlecode.protobuf.socketrpc.TestProtos.Response buildParsed()
  624. throws com.google.protobuf.InvalidProtocolBufferException {
  625. com.googlecode.protobuf.socketrpc.TestProtos.Response result = buildPartial();
  626. if (!result.isInitialized()) {
  627. throw newUninitializedMessageException(
  628. result).asInvalidProtocolBufferException();
  629. }
  630. return result;
  631. }
  632. public com.googlecode.protobuf.socketrpc.TestProtos.Response buildPartial() {
  633. com.googlecode.protobuf.socketrpc.TestProtos.Response result = new com.googlecode.protobuf.socketrpc.TestProtos.Response(this);
  634. int from_bitField0_ = bitField0_;
  635. int to_bitField0_ = 0;
  636. if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
  637. to_bitField0_ |= 0x00000001;
  638. }
  639. result.strData_ = strData_;
  640. if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
  641. to_bitField0_ |= 0x00000002;
  642. }
  643. result.intData_ = intData_;
  644. result.bitField0_ = to_bitField0_;
  645. onBuilt();
  646. return result;
  647. }
  648. public Builder mergeFrom(com.google.protobuf.Message other) {
  649. if (other instanceof com.googlecode.protobuf.socketrpc.TestProtos.Response) {
  650. return mergeFrom((com.googlecode.protobuf.socketrpc.TestProtos.Response)other);
  651. } else {
  652. super.mergeFrom(other);
  653. return this;
  654. }
  655. }
  656. public Builder mergeFrom(com.googlecode.protobuf.socketrpc.TestProtos.Response other) {
  657. if (other == com.googlecode.protobuf.socketrpc.TestProtos.Response.getDefaultInstance()) return this;
  658. if (other.hasStrData()) {
  659. setStrData(other.getStrData());
  660. }
  661. if (other.hasIntData()) {
  662. setIntData(other.getIntData());
  663. }
  664. this.mergeUnknownFields(other.getUnknownFields());
  665. return this;
  666. }
  667. public final boolean isInitialized() {
  668. if (!hasStrData()) {
  669. return false;
  670. }
  671. return true;
  672. }
  673. public Builder mergeFrom(
  674. com.google.protobuf.CodedInputStream input,
  675. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  676. throws java.io.IOException {
  677. com.google.protobuf.UnknownFieldSet.Builder unknownFields =
  678. com.google.protobuf.UnknownFieldSet.newBuilder(
  679. this.getUnknownFields());
  680. while (true) {
  681. int tag = input.readTag();
  682. switch (tag) {
  683. case 0:
  684. this.setUnknownFields(unknownFields.build());
  685. onChanged();
  686. return this;
  687. default: {
  688. if (!parseUnknownField(input, unknownFields,
  689. extensionRegistry, tag)) {
  690. this.setUnknownFields(unknownFields.build());
  691. onChanged();
  692. return this;
  693. }
  694. break;
  695. }
  696. case 10: {
  697. bitField0_ |= 0x00000001;
  698. strData_ = input.readBytes();
  699. break;
  700. }
  701. case 16: {
  702. bitField0_ |= 0x00000002;
  703. intData_ = input.readInt32();
  704. break;
  705. }
  706. }
  707. }
  708. }
  709. private int bitField0_;
  710. // required string str_data = 1;
  711. private Object strData_ = "";
  712. public boolean hasStrData() {
  713. return ((bitField0_ & 0x00000001) == 0x00000001);
  714. }
  715. public String getStrData() {
  716. Object ref = strData_;
  717. if (!(ref instanceof String)) {
  718. String s = ((com.google.protobuf.ByteString) ref).toStringUtf8();
  719. strData_ = s;
  720. return s;
  721. } else {
  722. return (String) ref;
  723. }
  724. }
  725. public Builder setStrData(String value) {
  726. if (value == null) {
  727. throw new NullPointerException();
  728. }
  729. bitField0_ |= 0x00000001;
  730. strData_ = value;
  731. onChanged();
  732. return this;
  733. }
  734. public Builder clearStrData() {
  735. bitField0_ = (bitField0_ & ~0x00000001);
  736. strData_ = getDefaultInstance().getStrData();
  737. onChanged();
  738. return this;
  739. }
  740. void setStrData(com.google.protobuf.ByteString value) {
  741. bitField0_ |= 0x00000001;
  742. strData_ = value;
  743. onChanged();
  744. }
  745. // optional int32 int_data = 2;
  746. private int intData_ ;
  747. public boolean hasIntData() {
  748. return ((bitField0_ & 0x00000002) == 0x00000002);
  749. }
  750. public int getIntData() {
  751. return intData_;
  752. }
  753. public Builder setIntData(int value) {
  754. bitField0_ |= 0x00000002;
  755. intData_ = value;
  756. onChanged();
  757. return this;
  758. }
  759. public Builder clearIntData() {
  760. bitField0_ = (bitField0_ & ~0x00000002);
  761. intData_ = 0;
  762. onChanged();
  763. return this;
  764. }
  765. // @@protoc_insertion_point(builder_scope:protobuf.socketrpc.Response)
  766. }
  767. static {
  768. defaultInstance = new Response(true);
  769. defaultInstance.initFields();
  770. }
  771. // @@protoc_insertion_point(class_scope:protobuf.socketrpc.Response)
  772. }
  773. public static abstract class TestService
  774. implements com.google.protobuf.Service {
  775. protected TestService() {}
  776. public interface Interface {
  777. public abstract void testMethod(
  778. com.google.protobuf.RpcController controller,
  779. com.googlecode.protobuf.socketrpc.TestProtos.Request request,
  780. com.google.protobuf.RpcCallback<com.googlecode.protobuf.socketrpc.TestProtos.Response> done);
  781. }
  782. public static com.google.protobuf.Service newReflectiveService(
  783. final Interface impl) {
  784. return new TestService() {
  785. @java.lang.Override
  786. public void testMethod(
  787. com.google.protobuf.RpcController controller,
  788. com.googlecode.protobuf.socketrpc.TestProtos.Request request,
  789. com.google.protobuf.RpcCallback<com.googlecode.protobuf.socketrpc.TestProtos.Response> done) {
  790. impl.testMethod(controller, request, done);
  791. }
  792. };
  793. }
  794. public static com.google.protobuf.BlockingService
  795. newReflectiveBlockingService(final BlockingInterface impl) {
  796. return new com.google.protobuf.BlockingService() {
  797. public final com.google.protobuf.Descriptors.ServiceDescriptor
  798. getDescriptorForType() {
  799. return getDescriptor();
  800. }
  801. public final com.google.protobuf.Message callBlockingMethod(
  802. com.google.protobuf.Descriptors.MethodDescriptor method,
  803. com.google.protobuf.RpcController controller,
  804. com.google.protobuf.Message request)
  805. throws com.google.protobuf.ServiceException {
  806. if (method.getService() != getDescriptor()) {
  807. throw new java.lang.IllegalArgumentException(
  808. "Service.callBlockingMethod() given method descriptor for " +
  809. "wrong service type.");
  810. }
  811. switch(method.getIndex()) {
  812. case 0:
  813. return impl.testMethod(controller, (com.googlecode.protobuf.socketrpc.TestProtos.Request)request);
  814. default:
  815. throw new java.lang.AssertionError("Can't get here.");
  816. }
  817. }
  818. public final com.google.protobuf.Message
  819. getRequestPrototype(
  820. com.google.protobuf.Descriptors.MethodDescriptor method) {
  821. if (method.getService() != getDescriptor()) {
  822. throw new java.lang.IllegalArgumentException(
  823. "Service.getRequestPrototype() given method " +
  824. "descriptor for wrong service type.");
  825. }
  826. switch(method.getIndex()) {
  827. case 0:
  828. return com.googlecode.protobuf.socketrpc.TestProtos.Request.getDefaultInstance();
  829. default:
  830. throw new java.lang.AssertionError("Can't get here.");
  831. }
  832. }
  833. public final com.google.protobuf.Message
  834. getResponsePrototype(
  835. com.google.protobuf.Descriptors.MethodDescriptor method) {
  836. if (method.getService() != getDescriptor()) {
  837. throw new java.lang.IllegalArgumentException(
  838. "Service.getResponsePrototype() given method " +
  839. "descriptor for wrong service type.");
  840. }
  841. switch(method.getIndex()) {
  842. case 0:
  843. return com.googlecode.protobuf.socketrpc.TestProtos.Response.getDefaultInstance();
  844. default:
  845. throw new java.lang.AssertionError("Can't get here.");
  846. }
  847. }
  848. };
  849. }
  850. public abstract void testMethod(
  851. com.google.protobuf.RpcController controller,
  852. com.googlecode.protobuf.socketrpc.TestProtos.Request request,
  853. com.google.protobuf.RpcCallback<com.googlecode.protobuf.socketrpc.TestProtos.Response> done);
  854. public static final
  855. com.google.protobuf.Descriptors.ServiceDescriptor
  856. getDescriptor() {
  857. return com.googlecode.protobuf.socketrpc.TestProtos.getDescriptor().getServices().get(0);
  858. }
  859. public final com.google.protobuf.Descriptors.ServiceDescriptor
  860. getDescriptorForType() {
  861. return getDescriptor();
  862. }
  863. public final void callMethod(
  864. com.google.protobuf.Descriptors.MethodDescriptor method,
  865. com.google.protobuf.RpcController controller,
  866. com.google.protobuf.Message request,
  867. com.google.protobuf.RpcCallback<
  868. com.google.protobuf.Message> done) {
  869. if (method.getService() != getDescriptor()) {
  870. throw new java.lang.IllegalArgumentException(
  871. "Service.callMethod() given method descriptor for wrong " +
  872. "service type.");
  873. }
  874. switch(method.getIndex()) {
  875. case 0:
  876. this.testMethod(controller, (com.googlecode.protobuf.socketrpc.TestProtos.Request)request,
  877. com.google.protobuf.RpcUtil.<com.googlecode.protobuf.socketrpc.TestProtos.Response>specializeCallback(
  878. done));
  879. return;
  880. default:
  881. throw new java.lang.AssertionError("Can't get here.");
  882. }
  883. }
  884. public final com.google.protobuf.Message
  885. getRequestPrototype(
  886. com.google.protobuf.Descriptors.MethodDescriptor method) {
  887. if (method.getService() != getDescriptor()) {
  888. throw new java.lang.IllegalArgumentException(
  889. "Service.getRequestPrototype() given method " +
  890. "descriptor for wrong service type.");
  891. }
  892. switch(method.getIndex()) {
  893. case 0:
  894. return com.googlecode.protobuf.socketrpc.TestProtos.Request.getDefaultInstance();
  895. default:
  896. throw new java.lang.AssertionError("Can't get here.");
  897. }
  898. }
  899. public final com.google.protobuf.Message
  900. getResponsePrototype(
  901. com.google.protobuf.Descriptors.MethodDescriptor method) {
  902. if (method.getService() != getDescriptor()) {
  903. throw new java.lang.IllegalArgumentException(
  904. "Service.getResponsePrototype() given method " +
  905. "descriptor for wrong service type.");
  906. }
  907. switch(method.getIndex()) {
  908. case 0:
  909. return com.googlecode.protobuf.socketrpc.TestProtos.Response.getDefaultInstance();
  910. default:
  911. throw new java.lang.AssertionError("Can't get here.");
  912. }
  913. }
  914. public static Stub newStub(
  915. com.google.protobuf.RpcChannel channel) {
  916. return new Stub(channel);
  917. }
  918. public static final class Stub extends com.googlecode.protobuf.socketrpc.TestProtos.TestService implements Interface {
  919. private Stub(com.google.protobuf.RpcChannel channel) {
  920. this.channel = channel;
  921. }
  922. private final com.google.protobuf.RpcChannel channel;
  923. public com.google.protobuf.RpcChannel getChannel() {
  924. return channel;
  925. }
  926. public void testMethod(
  927. com.google.protobuf.RpcController controller,
  928. com.googlecode.protobuf.socketrpc.TestProtos.Request request,
  929. com.google.protobuf.RpcCallback<com.googlecode.protobuf.socketrpc.TestProtos.Response> done) {
  930. channel.callMethod(
  931. getDescriptor().getMethods().get(0),
  932. controller,
  933. request,
  934. com.googlecode.protobuf.socketrpc.TestProtos.Response.getDefaultInstance(),
  935. com.google.protobuf.RpcUtil.generalizeCallback(
  936. done,
  937. com.googlecode.protobuf.socketrpc.TestProtos.Response.class,
  938. com.googlecode.protobuf.socketrpc.TestProtos.Response.getDefaultInstance()));
  939. }
  940. }
  941. public static BlockingInterface newBlockingStub(
  942. com.google.protobuf.BlockingRpcChannel channel) {
  943. return new BlockingStub(channel);
  944. }
  945. public interface BlockingInterface {
  946. public com.googlecode.protobuf.socketrpc.TestProtos.Response testMethod(
  947. com.google.protobuf.RpcController controller,
  948. com.googlecode.protobuf.socketrpc.TestProtos.Request request)
  949. throws com.google.protobuf.ServiceException;
  950. }
  951. private static final class BlockingStub implements BlockingInterface {
  952. private BlockingStub(com.google.protobuf.BlockingRpcChannel channel) {
  953. this.channel = channel;
  954. }
  955. private final com.google.protobuf.BlockingRpcChannel channel;
  956. public com.googlecode.protobuf.socketrpc.TestProtos.Response testMethod(
  957. com.google.protobuf.RpcController controller,
  958. com.googlecode.protobuf.socketrpc.TestProtos.Request request)
  959. throws com.google.protobuf.ServiceException {
  960. return (com.googlecode.protobuf.socketrpc.TestProtos.Response) channel.callBlockingMethod(
  961. getDescriptor().getMethods().get(0),
  962. controller,
  963. request,
  964. com.googlecode.protobuf.socketrpc.TestProtos.Response.getDefaultInstance());
  965. }
  966. }
  967. }
  968. private static com.google.protobuf.Descriptors.Descriptor
  969. internal_static_protobuf_socketrpc_Request_descriptor;
  970. private static
  971. com.google.protobuf.GeneratedMessage.FieldAccessorTable
  972. internal_static_protobuf_socketrpc_Request_fieldAccessorTable;
  973. private static com.google.protobuf.Descriptors.Descriptor
  974. internal_static_protobuf_socketrpc_Response_descriptor;
  975. private static
  976. com.google.protobuf.GeneratedMessage.FieldAccessorTable
  977. internal_static_protobuf_socketrpc_Response_fieldAccessorTable;
  978. public static com.google.protobuf.Descriptors.FileDescriptor
  979. getDescriptor() {
  980. return descriptor;
  981. }
  982. private static com.google.protobuf.Descriptors.FileDescriptor
  983. descriptor;
  984. static {
  985. java.lang.String[] descriptorData = {
  986. "\n?java/src/test/java/com/googlecode/prot" +
  987. "obuf/socketrpc/test.proto\022\022protobuf.sock" +
  988. "etrpc\"\033\n\007Request\022\020\n\010str_data\030\001 \002(\t\".\n\010Re" +
  989. "sponse\022\020\n\010str_data\030\001 \002(\t\022\020\n\010int_data\030\002 \001" +
  990. "(\0052V\n\013TestService\022G\n\nTestMethod\022\033.protob" +
  991. "uf.socketrpc.Request\032\034.protobuf.socketrp" +
  992. "c.ResponseB2\n!com.googlecode.protobuf.so" +
  993. "cketrpcB\nTestProtos\210\001\001"
  994. };
  995. com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
  996. new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
  997. public com.google.protobuf.ExtensionRegistry assignDescriptors(
  998. com.google.protobuf.Descriptors.FileDescriptor root) {
  999. descriptor = root;
  1000. internal_static_protobuf_socketrpc_Request_descriptor =
  1001. getDescriptor().getMessageTypes().get(0);
  1002. internal_static_protobuf_socketrpc_Request_fieldAccessorTable = new
  1003. com.google.protobuf.GeneratedMessage.FieldAccessorTable(
  1004. internal_static_protobuf_socketrpc_Request_descriptor,
  1005. new java.lang.String[] { "StrData", },
  1006. com.googlecode.protobuf.socketrpc.TestProtos.Request.class,
  1007. com.googlecode.protobuf.socketrpc.TestProtos.Request.Builder.class);
  1008. internal_static_protobuf_socketrpc_Response_descriptor =
  1009. getDescriptor().getMessageTypes().get(1);
  1010. internal_static_protobuf_socketrpc_Response_fieldAccessorTable = new
  1011. com.google.protobuf.GeneratedMessage.FieldAccessorTable(
  1012. internal_static_protobuf_socketrpc_Response_descriptor,
  1013. new java.lang.String[] { "StrData", "IntData", },
  1014. com.googlecode.protobuf.socketrpc.TestProtos.Response.class,
  1015. com.googlecode.protobuf.socketrpc.TestProtos.Response.Builder.class);
  1016. return null;
  1017. }
  1018. };
  1019. com.google.protobuf.Descriptors.FileDescriptor
  1020. .internalBuildGeneratedFileFrom(descriptorData,
  1021. new com.google.protobuf.Descriptors.FileDescriptor[] {
  1022. }, assigner);
  1023. }
  1024. // @@protoc_insertion_point(outer_class_scope)
  1025. }