Field.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <?php
  2. # Generated by the protocol buffer compiler. DO NOT EDIT!
  3. # source: google/protobuf/type.proto
  4. namespace Google\Protobuf;
  5. use Google\Protobuf\Internal\GPBType;
  6. use Google\Protobuf\Internal\RepeatedField;
  7. use Google\Protobuf\Internal\GPBUtil;
  8. /**
  9. * A single field of a message type.
  10. *
  11. * Generated from protobuf message <code>google.protobuf.Field</code>
  12. */
  13. class Field extends \Google\Protobuf\Internal\Message
  14. {
  15. /**
  16. * The field type.
  17. *
  18. * Generated from protobuf field <code>.google.protobuf.Field.Kind kind = 1;</code>
  19. */
  20. private $kind = 0;
  21. /**
  22. * The field cardinality.
  23. *
  24. * Generated from protobuf field <code>.google.protobuf.Field.Cardinality cardinality = 2;</code>
  25. */
  26. private $cardinality = 0;
  27. /**
  28. * The field number.
  29. *
  30. * Generated from protobuf field <code>int32 number = 3;</code>
  31. */
  32. private $number = 0;
  33. /**
  34. * The field name.
  35. *
  36. * Generated from protobuf field <code>string name = 4;</code>
  37. */
  38. private $name = '';
  39. /**
  40. * The field type URL, without the scheme, for message or enumeration
  41. * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
  42. *
  43. * Generated from protobuf field <code>string type_url = 6;</code>
  44. */
  45. private $type_url = '';
  46. /**
  47. * The index of the field type in `Type.oneofs`, for message or enumeration
  48. * types. The first type has index 1; zero means the type is not in the list.
  49. *
  50. * Generated from protobuf field <code>int32 oneof_index = 7;</code>
  51. */
  52. private $oneof_index = 0;
  53. /**
  54. * Whether to use alternative packed wire representation.
  55. *
  56. * Generated from protobuf field <code>bool packed = 8;</code>
  57. */
  58. private $packed = false;
  59. /**
  60. * The protocol buffer options.
  61. *
  62. * Generated from protobuf field <code>repeated .google.protobuf.Option options = 9;</code>
  63. */
  64. private $options;
  65. /**
  66. * The field JSON name.
  67. *
  68. * Generated from protobuf field <code>string json_name = 10;</code>
  69. */
  70. private $json_name = '';
  71. /**
  72. * The string value of the default value of this field. Proto2 syntax only.
  73. *
  74. * Generated from protobuf field <code>string default_value = 11;</code>
  75. */
  76. private $default_value = '';
  77. public function __construct() {
  78. \GPBMetadata\Google\Protobuf\Type::initOnce();
  79. parent::__construct();
  80. }
  81. /**
  82. * The field type.
  83. *
  84. * Generated from protobuf field <code>.google.protobuf.Field.Kind kind = 1;</code>
  85. * @return int
  86. */
  87. public function getKind()
  88. {
  89. return $this->kind;
  90. }
  91. /**
  92. * The field type.
  93. *
  94. * Generated from protobuf field <code>.google.protobuf.Field.Kind kind = 1;</code>
  95. * @param int $var
  96. * @return $this
  97. */
  98. public function setKind($var)
  99. {
  100. GPBUtil::checkEnum($var, \Google\Protobuf\Field_Kind::class);
  101. $this->kind = $var;
  102. return $this;
  103. }
  104. /**
  105. * The field cardinality.
  106. *
  107. * Generated from protobuf field <code>.google.protobuf.Field.Cardinality cardinality = 2;</code>
  108. * @return int
  109. */
  110. public function getCardinality()
  111. {
  112. return $this->cardinality;
  113. }
  114. /**
  115. * The field cardinality.
  116. *
  117. * Generated from protobuf field <code>.google.protobuf.Field.Cardinality cardinality = 2;</code>
  118. * @param int $var
  119. * @return $this
  120. */
  121. public function setCardinality($var)
  122. {
  123. GPBUtil::checkEnum($var, \Google\Protobuf\Field_Cardinality::class);
  124. $this->cardinality = $var;
  125. return $this;
  126. }
  127. /**
  128. * The field number.
  129. *
  130. * Generated from protobuf field <code>int32 number = 3;</code>
  131. * @return int
  132. */
  133. public function getNumber()
  134. {
  135. return $this->number;
  136. }
  137. /**
  138. * The field number.
  139. *
  140. * Generated from protobuf field <code>int32 number = 3;</code>
  141. * @param int $var
  142. * @return $this
  143. */
  144. public function setNumber($var)
  145. {
  146. GPBUtil::checkInt32($var);
  147. $this->number = $var;
  148. return $this;
  149. }
  150. /**
  151. * The field name.
  152. *
  153. * Generated from protobuf field <code>string name = 4;</code>
  154. * @return string
  155. */
  156. public function getName()
  157. {
  158. return $this->name;
  159. }
  160. /**
  161. * The field name.
  162. *
  163. * Generated from protobuf field <code>string name = 4;</code>
  164. * @param string $var
  165. * @return $this
  166. */
  167. public function setName($var)
  168. {
  169. GPBUtil::checkString($var, True);
  170. $this->name = $var;
  171. return $this;
  172. }
  173. /**
  174. * The field type URL, without the scheme, for message or enumeration
  175. * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
  176. *
  177. * Generated from protobuf field <code>string type_url = 6;</code>
  178. * @return string
  179. */
  180. public function getTypeUrl()
  181. {
  182. return $this->type_url;
  183. }
  184. /**
  185. * The field type URL, without the scheme, for message or enumeration
  186. * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
  187. *
  188. * Generated from protobuf field <code>string type_url = 6;</code>
  189. * @param string $var
  190. * @return $this
  191. */
  192. public function setTypeUrl($var)
  193. {
  194. GPBUtil::checkString($var, True);
  195. $this->type_url = $var;
  196. return $this;
  197. }
  198. /**
  199. * The index of the field type in `Type.oneofs`, for message or enumeration
  200. * types. The first type has index 1; zero means the type is not in the list.
  201. *
  202. * Generated from protobuf field <code>int32 oneof_index = 7;</code>
  203. * @return int
  204. */
  205. public function getOneofIndex()
  206. {
  207. return $this->oneof_index;
  208. }
  209. /**
  210. * The index of the field type in `Type.oneofs`, for message or enumeration
  211. * types. The first type has index 1; zero means the type is not in the list.
  212. *
  213. * Generated from protobuf field <code>int32 oneof_index = 7;</code>
  214. * @param int $var
  215. * @return $this
  216. */
  217. public function setOneofIndex($var)
  218. {
  219. GPBUtil::checkInt32($var);
  220. $this->oneof_index = $var;
  221. return $this;
  222. }
  223. /**
  224. * Whether to use alternative packed wire representation.
  225. *
  226. * Generated from protobuf field <code>bool packed = 8;</code>
  227. * @return bool
  228. */
  229. public function getPacked()
  230. {
  231. return $this->packed;
  232. }
  233. /**
  234. * Whether to use alternative packed wire representation.
  235. *
  236. * Generated from protobuf field <code>bool packed = 8;</code>
  237. * @param bool $var
  238. * @return $this
  239. */
  240. public function setPacked($var)
  241. {
  242. GPBUtil::checkBool($var);
  243. $this->packed = $var;
  244. return $this;
  245. }
  246. /**
  247. * The protocol buffer options.
  248. *
  249. * Generated from protobuf field <code>repeated .google.protobuf.Option options = 9;</code>
  250. * @return \Google\Protobuf\Internal\RepeatedField
  251. */
  252. public function getOptions()
  253. {
  254. return $this->options;
  255. }
  256. /**
  257. * The protocol buffer options.
  258. *
  259. * Generated from protobuf field <code>repeated .google.protobuf.Option options = 9;</code>
  260. * @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
  261. * @return $this
  262. */
  263. public function setOptions($var)
  264. {
  265. $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class);
  266. $this->options = $arr;
  267. return $this;
  268. }
  269. /**
  270. * The field JSON name.
  271. *
  272. * Generated from protobuf field <code>string json_name = 10;</code>
  273. * @return string
  274. */
  275. public function getJsonName()
  276. {
  277. return $this->json_name;
  278. }
  279. /**
  280. * The field JSON name.
  281. *
  282. * Generated from protobuf field <code>string json_name = 10;</code>
  283. * @param string $var
  284. * @return $this
  285. */
  286. public function setJsonName($var)
  287. {
  288. GPBUtil::checkString($var, True);
  289. $this->json_name = $var;
  290. return $this;
  291. }
  292. /**
  293. * The string value of the default value of this field. Proto2 syntax only.
  294. *
  295. * Generated from protobuf field <code>string default_value = 11;</code>
  296. * @return string
  297. */
  298. public function getDefaultValue()
  299. {
  300. return $this->default_value;
  301. }
  302. /**
  303. * The string value of the default value of this field. Proto2 syntax only.
  304. *
  305. * Generated from protobuf field <code>string default_value = 11;</code>
  306. * @param string $var
  307. * @return $this
  308. */
  309. public function setDefaultValue($var)
  310. {
  311. GPBUtil::checkString($var, True);
  312. $this->default_value = $var;
  313. return $this;
  314. }
  315. }