conformance_response.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /**
  2. * @fileoverview Handwritten code of ConformanceResponse.
  3. */
  4. goog.module('proto.conformance.ConformanceResponse');
  5. const ByteString = goog.require('protobuf.ByteString');
  6. const Kernel = goog.require('protobuf.runtime.Kernel');
  7. /**
  8. * Handwritten code of conformance.ConformanceResponse.
  9. * This is used to send response from the conformance testee to the test runner.
  10. * Check //third_party/protobuf/testing/protobuf/conformance/conformance.proto
  11. * for more details.
  12. * @final
  13. */
  14. class ConformanceResponse {
  15. /**
  16. * @param {!ArrayBuffer} bytes
  17. * @private
  18. */
  19. constructor(bytes) {
  20. /** @private @const {!Kernel} */
  21. this.accessor_ = Kernel.fromArrayBuffer(bytes);
  22. }
  23. /**
  24. * Create an empty response instance.
  25. * @return {!ConformanceResponse}
  26. */
  27. static createEmpty() {
  28. return new ConformanceResponse(new ArrayBuffer(0));
  29. }
  30. /**
  31. * Sets parse_error field.
  32. * @param {string} value
  33. */
  34. setParseError(value) {
  35. this.accessor_.setString(1, value);
  36. }
  37. /**
  38. * Sets runtime_error field.
  39. * @param {string} value
  40. */
  41. setRuntimeError(value) {
  42. this.accessor_.setString(2, value);
  43. }
  44. /**
  45. * Sets protobuf_payload field.
  46. * @param {!ArrayBuffer} value
  47. */
  48. setProtobufPayload(value) {
  49. const bytesString = ByteString.fromArrayBuffer(value);
  50. this.accessor_.setBytes(3, bytesString);
  51. }
  52. /**
  53. * Sets skipped field.
  54. * @param {string} value
  55. */
  56. setSkipped(value) {
  57. this.accessor_.setString(5, value);
  58. }
  59. /**
  60. * Serializes into binary data.
  61. * @return {!ArrayBuffer}
  62. */
  63. serialize() {
  64. return this.accessor_.serialize();
  65. }
  66. }
  67. exports = ConformanceResponse;