1<?hh // strict
2/**
3 * Autogenerated by Thrift
4 *
5 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
6 *  @generated
7 */
8
9/**
10 * Original thrift enum:-
11 * MyEnum
12 */
13enum MyEnum: int {
14  MyValue1 = 0;
15  MyValue2 = 1;
16}
17
18class MyEnum_TEnumStaticMetadata implements \IThriftEnumStaticMetadata {
19  public static function getEnumMetadata()[]: \tmeta_ThriftEnum {
20    return tmeta_ThriftEnum::fromShape(
21      shape(
22        "name" => "module.MyEnum",
23        "elements" => dict[
24          0 => "MyValue1",
25          1 => "MyValue2",
26        ],
27      )
28    );
29  }
30
31  public static function getAllStructuredAnnotations()[]: \TEnumAnnotations {
32    return shape(
33      'enum' => dict[],
34      'constants' => dict[
35      ],
36    );
37  }
38}
39
40/**
41 * Original thrift exception:-
42 * MyException1
43 */
44class MyException1 extends \TException implements \IThriftStruct {
45  use \ThriftSerializationTrait;
46
47  const dict<int, this::TFieldSpec> SPEC = dict[
48    1 => shape(
49      'var' => 'message',
50      'type' => \TType::STRING,
51    ),
52    2 => shape(
53      'var' => 'code',
54      'type' => \TType::I32,
55      'enum' => MyEnum::class,
56    ),
57  ];
58  const dict<string, int> FIELDMAP = dict[
59    'message' => 1,
60    'code' => 2,
61  ];
62
63  const type TConstructorShape = shape(
64    ?'message' => ?string,
65    ?'code' => ?MyEnum,
66  );
67
68  const int STRUCTURAL_ID = 7711048519845400283;
69  /**
70   * Original thrift field:-
71   * 1: string message
72   */
73  public string $message;
74  /**
75   * Original thrift field:-
76   * 2: enum module.MyEnum code
77   */
78  public /* Originally defined as MyEnum */ int $code;
79
80  public function setCodeAsEnum(MyEnum $code)[write_props]: void {
81    /* HH_FIXME[4110] nontransparent enum */
82    $this->code = $code;
83  }
84
85  public function getCodeAsEnum()[]: MyEnum {
86    /* HH_FIXME[4110] retain HHVM enforcement semantics */
87    return $this->code;
88  }
89
90  public function __construct(?string $message = null, ?MyEnum $code = null  )[] {
91    parent::__construct();
92    $this->message = $message ?? '';
93      /* HH_FIXME[4110] nontransparent Enum */
94    $this->code = $code ?? MyEnum::MyValue1;
95  }
96
97  public static function withDefaultValues()[]: this {
98    return new static();
99  }
100
101  public static function fromShape(self::TConstructorShape $shape)[]: this {
102    return new static(
103      Shapes::idx($shape, 'message'),
104      Shapes::idx($shape, 'code'),
105    );
106  }
107
108  public function getName()[]: string {
109    return 'MyException1';
110  }
111
112  public static function getExceptionMetadata()[]: \tmeta_ThriftException {
113    return tmeta_ThriftException::fromShape(
114      shape(
115        "name" => "module.MyException1",
116        "fields" => vec[
117          tmeta_ThriftField::fromShape(
118            shape(
119              "id" => 1,
120              "type" => tmeta_ThriftType::fromShape(
121                shape(
122                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
123                )
124              ),
125              "name" => "message",
126            )
127          ),
128          tmeta_ThriftField::fromShape(
129            shape(
130              "id" => 2,
131              "type" => tmeta_ThriftType::fromShape(
132                shape(
133                  "t_enum" => tmeta_ThriftEnumType::fromShape(
134                    shape(
135                      "name" => "module.MyEnum",
136                    )
137                  ),
138                )
139              ),
140              "name" => "code",
141              "is_optional" => true,
142            )
143          ),
144        ],
145      )
146    );
147  }
148
149  public static function getAllStructuredAnnotations()[]: \TStructAnnotations {
150    return shape(
151      'struct' => dict[],
152      'fields' => dict[
153      ],
154    );
155  }
156
157}
158
159/**
160 * Original thrift exception:-
161 * MyException2
162 */
163class MyException2 extends \TException implements \IThriftStruct {
164  use \ThriftSerializationTrait;
165
166  const dict<int, this::TFieldSpec> SPEC = dict[
167    1 => shape(
168      'var' => 'message',
169      'type' => \TType::STRING,
170    ),
171    2 => shape(
172      'var' => 'code',
173      'type' => \TType::I32,
174      'enum' => MyEnum::class,
175    ),
176  ];
177  const dict<string, int> FIELDMAP = dict[
178    'message' => 1,
179    'code' => 2,
180  ];
181
182  const type TConstructorShape = shape(
183    ?'message' => ?string,
184    ?'code' => ?MyEnum,
185  );
186
187  const int STRUCTURAL_ID = 3067783023341493113;
188  /**
189   * Original thrift field:-
190   * 1: string message
191   */
192  public string $message;
193  /**
194   * Original thrift field:-
195   * 2: enum module.MyEnum code
196   */
197  public /* Originally defined as MyEnum */ int $code;
198
199  public function setCodeAsEnum(MyEnum $code)[write_props]: void {
200    /* HH_FIXME[4110] nontransparent enum */
201    $this->code = $code;
202  }
203
204  public function getCodeAsEnum()[]: MyEnum {
205    /* HH_FIXME[4110] retain HHVM enforcement semantics */
206    return $this->code;
207  }
208
209  public function __construct(?string $message = null, ?MyEnum $code = null  )[] {
210    parent::__construct();
211    $this->message = $message ?? '';
212      /* HH_FIXME[4110] nontransparent Enum */
213    $this->code = $code ?? MyEnum::MyValue1;
214  }
215
216  public static function withDefaultValues()[]: this {
217    return new static();
218  }
219
220  public static function fromShape(self::TConstructorShape $shape)[]: this {
221    return new static(
222      Shapes::idx($shape, 'message'),
223      Shapes::idx($shape, 'code'),
224    );
225  }
226
227  public function getName()[]: string {
228    return 'MyException2';
229  }
230
231  public static function getExceptionMetadata()[]: \tmeta_ThriftException {
232    return tmeta_ThriftException::fromShape(
233      shape(
234        "name" => "module.MyException2",
235        "fields" => vec[
236          tmeta_ThriftField::fromShape(
237            shape(
238              "id" => 1,
239              "type" => tmeta_ThriftType::fromShape(
240                shape(
241                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
242                )
243              ),
244              "name" => "message",
245            )
246          ),
247          tmeta_ThriftField::fromShape(
248            shape(
249              "id" => 2,
250              "type" => tmeta_ThriftType::fromShape(
251                shape(
252                  "t_enum" => tmeta_ThriftEnumType::fromShape(
253                    shape(
254                      "name" => "module.MyEnum",
255                    )
256                  ),
257                )
258              ),
259              "name" => "code",
260            )
261          ),
262        ],
263      )
264    );
265  }
266
267  public static function getAllStructuredAnnotations()[]: \TStructAnnotations {
268    return shape(
269      'struct' => dict[],
270      'fields' => dict[
271      ],
272    );
273  }
274
275}
276
277/**
278 * Original thrift exception:-
279 * MyException3
280 */
281class MyException3 extends \TException implements \IThriftStruct {
282  use \ThriftSerializationTrait;
283
284  const dict<int, this::TFieldSpec> SPEC = dict[
285    1 => shape(
286      'var' => 'message',
287      'type' => \TType::STRING,
288    ),
289    2 => shape(
290      'var' => 'code',
291      'type' => \TType::I32,
292      'enum' => MyEnum::class,
293    ),
294  ];
295  const dict<string, int> FIELDMAP = dict[
296    'message' => 1,
297    'code' => 2,
298  ];
299
300  const type TConstructorShape = shape(
301    ?'message' => ?string,
302    ?'code' => ?MyEnum,
303  );
304
305  const int STRUCTURAL_ID = 3517193566312570591;
306  /**
307   * Original thrift field:-
308   * 1: string message
309   */
310  public string $message;
311  /**
312   * Original thrift field:-
313   * 2: enum module.MyEnum code
314   */
315  public /* Originally defined as MyEnum */ int $code;
316
317  public function setCodeAsEnum(MyEnum $code)[write_props]: void {
318    /* HH_FIXME[4110] nontransparent enum */
319    $this->code = $code;
320  }
321
322  public function getCodeAsEnum()[]: MyEnum {
323    /* HH_FIXME[4110] retain HHVM enforcement semantics */
324    return $this->code;
325  }
326
327  public function __construct(?string $message = null, ?MyEnum $code = null  )[] {
328    parent::__construct();
329    $this->message = $message ?? '';
330      /* HH_FIXME[4110] nontransparent Enum */
331    $this->code = $code ?? MyEnum::MyValue1;
332  }
333
334  public static function withDefaultValues()[]: this {
335    return new static();
336  }
337
338  public static function fromShape(self::TConstructorShape $shape)[]: this {
339    return new static(
340      Shapes::idx($shape, 'message'),
341      Shapes::idx($shape, 'code'),
342    );
343  }
344
345  public function getName()[]: string {
346    return 'MyException3';
347  }
348
349  public static function getExceptionMetadata()[]: \tmeta_ThriftException {
350    return tmeta_ThriftException::fromShape(
351      shape(
352        "name" => "module.MyException3",
353        "fields" => vec[
354          tmeta_ThriftField::fromShape(
355            shape(
356              "id" => 1,
357              "type" => tmeta_ThriftType::fromShape(
358                shape(
359                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
360                )
361              ),
362              "name" => "message",
363            )
364          ),
365          tmeta_ThriftField::fromShape(
366            shape(
367              "id" => 2,
368              "type" => tmeta_ThriftType::fromShape(
369                shape(
370                  "t_enum" => tmeta_ThriftEnumType::fromShape(
371                    shape(
372                      "name" => "module.MyEnum",
373                    )
374                  ),
375                )
376              ),
377              "name" => "code",
378            )
379          ),
380        ],
381      )
382    );
383  }
384
385  public static function getAllStructuredAnnotations()[]: \TStructAnnotations {
386    return shape(
387      'struct' => dict[],
388      'fields' => dict[
389      ],
390    );
391  }
392
393}
394
395/**
396 * Original thrift exception:-
397 * MyException4
398 */
399class MyException4 extends \TException implements \IThriftStruct {
400  use \ThriftSerializationTrait;
401
402  const dict<int, this::TFieldSpec> SPEC = dict[
403    1 => shape(
404      'var' => 'message',
405      'type' => \TType::STRING,
406    ),
407    2 => shape(
408      'var' => 'code',
409      'type' => \TType::I32,
410      'enum' => MyEnum::class,
411    ),
412  ];
413  const dict<string, int> FIELDMAP = dict[
414    'message' => 1,
415    'code' => 2,
416  ];
417
418  const type TConstructorShape = shape(
419    ?'message' => ?string,
420    ?'code' => ?MyEnum,
421  );
422
423  const int STRUCTURAL_ID = 3517193566312570591;
424  /**
425   * Original thrift field:-
426   * 1: string message
427   */
428  public string $message;
429  /**
430   * Original thrift field:-
431   * 2: enum module.MyEnum code
432   */
433  public /* Originally defined as MyEnum */ int $code;
434
435  public function setCodeAsEnum(MyEnum $code)[write_props]: void {
436    /* HH_FIXME[4110] nontransparent enum */
437    $this->code = $code;
438  }
439
440  public function getCodeAsEnum()[]: MyEnum {
441    /* HH_FIXME[4110] retain HHVM enforcement semantics */
442    return $this->code;
443  }
444
445  public function __construct(?string $message = null, ?MyEnum $code = null  )[] {
446    parent::__construct();
447    $this->message = $message ?? '';
448      /* HH_FIXME[4110] nontransparent Enum */
449    $this->code = $code ?? MyEnum::MyValue2;
450  }
451
452  public static function withDefaultValues()[]: this {
453    return new static();
454  }
455
456  public static function fromShape(self::TConstructorShape $shape)[]: this {
457    return new static(
458      Shapes::idx($shape, 'message'),
459      Shapes::idx($shape, 'code'),
460    );
461  }
462
463  public function getName()[]: string {
464    return 'MyException4';
465  }
466
467  public static function getExceptionMetadata()[]: \tmeta_ThriftException {
468    return tmeta_ThriftException::fromShape(
469      shape(
470        "name" => "module.MyException4",
471        "fields" => vec[
472          tmeta_ThriftField::fromShape(
473            shape(
474              "id" => 1,
475              "type" => tmeta_ThriftType::fromShape(
476                shape(
477                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
478                )
479              ),
480              "name" => "message",
481            )
482          ),
483          tmeta_ThriftField::fromShape(
484            shape(
485              "id" => 2,
486              "type" => tmeta_ThriftType::fromShape(
487                shape(
488                  "t_enum" => tmeta_ThriftEnumType::fromShape(
489                    shape(
490                      "name" => "module.MyEnum",
491                    )
492                  ),
493                )
494              ),
495              "name" => "code",
496            )
497          ),
498        ],
499      )
500    );
501  }
502
503  public static function getAllStructuredAnnotations()[]: \TStructAnnotations {
504    return shape(
505      'struct' => dict[],
506      'fields' => dict[
507      ],
508    );
509  }
510
511}
512
513/**
514 * Original thrift exception:-
515 * MyException5
516 */
517class MyException5 extends \TException implements \IThriftStruct {
518  use \ThriftSerializationTrait;
519
520  const dict<int, this::TFieldSpec> SPEC = dict[
521    1 => shape(
522      'var' => 'message',
523      'type' => \TType::STRING,
524    ),
525    2 => shape(
526      'var' => 'code',
527      'type' => \TType::I64,
528    ),
529  ];
530  const dict<string, int> FIELDMAP = dict[
531    'message' => 1,
532    'code' => 2,
533  ];
534
535  const type TConstructorShape = shape(
536    ?'message' => ?string,
537    ?'code' => ?int,
538  );
539
540  const int STRUCTURAL_ID = 7335721753390449361;
541  /**
542   * Original thrift field:-
543   * 1: string message
544   */
545  public string $message;
546  /**
547   * Original thrift field:-
548   * 2: i64 code
549   */
550  public int $code;
551
552  public function __construct(?string $message = null, ?int $code = null  )[] {
553    parent::__construct();
554    $this->message = $message ?? '';
555    $this->code = $code ?? 0;
556  }
557
558  public static function withDefaultValues()[]: this {
559    return new static();
560  }
561
562  public static function fromShape(self::TConstructorShape $shape)[]: this {
563    return new static(
564      Shapes::idx($shape, 'message'),
565      Shapes::idx($shape, 'code'),
566    );
567  }
568
569  public function getName()[]: string {
570    return 'MyException5';
571  }
572
573  public static function getExceptionMetadata()[]: \tmeta_ThriftException {
574    return tmeta_ThriftException::fromShape(
575      shape(
576        "name" => "module.MyException5",
577        "fields" => vec[
578          tmeta_ThriftField::fromShape(
579            shape(
580              "id" => 1,
581              "type" => tmeta_ThriftType::fromShape(
582                shape(
583                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
584                )
585              ),
586              "name" => "message",
587            )
588          ),
589          tmeta_ThriftField::fromShape(
590            shape(
591              "id" => 2,
592              "type" => tmeta_ThriftType::fromShape(
593                shape(
594                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE,
595                )
596              ),
597              "name" => "code",
598              "is_optional" => true,
599            )
600          ),
601        ],
602      )
603    );
604  }
605
606  public static function getAllStructuredAnnotations()[]: \TStructAnnotations {
607    return shape(
608      'struct' => dict[],
609      'fields' => dict[
610      ],
611    );
612  }
613
614}
615
616