1 module hunt.amqp.generated.ProtonLinkOptionsConverter;
2 
3 //import io.vertx.core.json.JsonObject;
4 //import io.vertx.core.json.JsonArray;
5 
6 import hunt.amqp.ProtonLinkOptions;
7 import hunt.collection.Map;
8 import hunt.String;
9 import hunt.Boolean;
10 import std.json;
11 import hunt.collection.LinkedHashMap;
12 import std.variant;
13 /**
14 
15  * Converter and mapper for {@link io.vertx.proton.ProtonLinkOptions}.
16  * NOTE: This class has been automatically generated from the {@link io.vertx.proton.ProtonLinkOptions} original class using Vert.x codegen.
17  */
18 class ProtonLinkOptionsConverter {
19    static void fromJson(Map!(string, Variant) json, ProtonLinkOptions obj) {
20     foreach (MapEntry!(string, Variant)  member ; json) {
21       switch (member.getKey()) {
22         case "dynamic":
23          JSONValue js = *(member.getValue()).peek!JSONValue;
24           //bool b = *(member.getValue()).peek!bool;
25           //if (js !is null) {
26             obj.setDynamic(js.boolean);
27           //}
28           break;
29         case "linkName":
30         JSONValue js = *(member.getValue()).peek!JSONValue;
31           //string s = *(member.getValue()).peek!string;
32           //if (js !is null) {
33             obj.setLinkName(js.str);
34           //}
35           break;
36         default:
37           break;
38       }
39     }
40   }
41 
42     //   foreach (string key, value; jv)
43     //{
44     //    static assert(is(typeof(value) == JSONValue));
45     //    assert(key == "key");
46     //    assert(value.type == JSONType.string);
47     //    assertNotThrown(value.str);
48     //    assert(value.str == "value");
49     //}
50 
51    static void toJson(ProtonLinkOptions obj, JSONValue json) {
52        Map!(string, Variant) mp = new LinkedHashMap!(string,Variant)();
53        foreach (string key, value; json)
54        {
55            Variant tmp = value;
56            mp.put(key,tmp);
57        }
58        toJson(obj, mp);
59   }
60 
61    static void toJson(ProtonLinkOptions obj, Map!(string, Variant) json) {
62      Variant dy =    obj.isDynamic();
63     json.put("dynamic",  dy);
64     if (obj.getLinkName().length != 0) {
65       Variant ln =   obj.getLinkName();
66       json.put("linkName", ln);
67     }
68   }
69 }