blob: 68c050e61b13f6724ce757ec60348d4b7297e5e2 [file] [log] [blame]
James Kuszmaul8e62b022022-03-22 09:33:25 -07001// <auto-generated>
2// automatically generated by the FlatBuffers compiler, do not modify
3// </auto-generated>
4
5namespace KeywordTest
6{
7
8[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
9public enum KeywordsInUnion : byte
10{
11 NONE = 0,
12 @static = 1,
13 @internal = 2,
14};
15
16public class KeywordsInUnionUnion {
17 public KeywordsInUnion Type { get; set; }
18 public object Value { get; set; }
19
20 public KeywordsInUnionUnion() {
21 this.Type = KeywordsInUnion.NONE;
22 this.Value = null;
23 }
24
25 public T As<T>() where T : class { return this.Value as T; }
26 public KeywordTest.KeywordsInTableT Asstatic() { return this.As<KeywordTest.KeywordsInTableT>(); }
27 public static KeywordsInUnionUnion Fromstatic(KeywordTest.KeywordsInTableT _static) { return new KeywordsInUnionUnion{ Type = KeywordsInUnion.@static, Value = _static }; }
28 public KeywordTest.KeywordsInTableT Asinternal() { return this.As<KeywordTest.KeywordsInTableT>(); }
29 public static KeywordsInUnionUnion Frominternal(KeywordTest.KeywordsInTableT _internal) { return new KeywordsInUnionUnion{ Type = KeywordsInUnion.@internal, Value = _internal }; }
30
31 public static int Pack(FlatBuffers.FlatBufferBuilder builder, KeywordsInUnionUnion _o) {
32 switch (_o.Type) {
33 default: return 0;
34 case KeywordsInUnion.@static: return KeywordTest.KeywordsInTable.Pack(builder, _o.Asstatic()).Value;
35 case KeywordsInUnion.@internal: return KeywordTest.KeywordsInTable.Pack(builder, _o.Asinternal()).Value;
36 }
37 }
38}
39
40public class KeywordsInUnionUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
41 public override bool CanConvert(System.Type objectType) {
42 return objectType == typeof(KeywordsInUnionUnion) || objectType == typeof(System.Collections.Generic.List<KeywordsInUnionUnion>);
43 }
44 public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) {
45 var _olist = value as System.Collections.Generic.List<KeywordsInUnionUnion>;
46 if (_olist != null) {
47 writer.WriteStartArray();
48 foreach (var _o in _olist) { this.WriteJson(writer, _o, serializer); }
49 writer.WriteEndArray();
50 } else {
51 this.WriteJson(writer, value as KeywordsInUnionUnion, serializer);
52 }
53 }
54 public void WriteJson(Newtonsoft.Json.JsonWriter writer, KeywordsInUnionUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
55 if (_o == null) return;
56 serializer.Serialize(writer, _o.Value);
57 }
58 public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) {
59 var _olist = existingValue as System.Collections.Generic.List<KeywordsInUnionUnion>;
60 if (_olist != null) {
61 for (var _j = 0; _j < _olist.Count; ++_j) {
62 reader.Read();
63 _olist[_j] = this.ReadJson(reader, _olist[_j], serializer);
64 }
65 reader.Read();
66 return _olist;
67 } else {
68 return this.ReadJson(reader, existingValue as KeywordsInUnionUnion, serializer);
69 }
70 }
71 public KeywordsInUnionUnion ReadJson(Newtonsoft.Json.JsonReader reader, KeywordsInUnionUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
72 if (_o == null) return null;
73 switch (_o.Type) {
74 default: break;
75 case KeywordsInUnion.@static: _o.Value = serializer.Deserialize<KeywordTest.KeywordsInTableT>(reader); break;
76 case KeywordsInUnion.@internal: _o.Value = serializer.Deserialize<KeywordTest.KeywordsInTableT>(reader); break;
77 }
78 return _o;
79 }
80}
81
82
83}