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