コード例 #1
0
 public static void fromJson(JsonObject json, VertxApiRequest obj) {
   if (json.getValue("apiKey") instanceof String) {
     obj.setApiKey((String) json.getValue("apiKey"));
   }
   if (json.getValue("destination") instanceof String) {
     obj.setDestination((String) json.getValue("destination"));
   }
   if (json.getValue("headers") instanceof JsonObject) {
     HeaderMap map = new HeaderMap();
     json.getJsonObject("headers")
         .forEach(
             entry -> {
               if (entry.getValue() instanceof String)
                 map.put(entry.getKey(), (String) entry.getValue());
             });
     obj.setHeaders(map);
   }
   if (json.getValue("queryParams") instanceof JsonObject) {
     QueryMap map = new QueryMap();
     json.getJsonObject("queryParams")
         .forEach(
             entry -> {
               if (entry.getValue() instanceof String)
                 map.put(entry.getKey(), (String) entry.getValue());
             });
     obj.setQueryParams(map);
   }
   if (json.getValue("rawRequest") instanceof Object) {
     obj.setRawRequest(json.getValue("rawRequest"));
   }
   if (json.getValue("remoteAddr") instanceof String) {
     obj.setRemoteAddr((String) json.getValue("remoteAddr"));
   }
   if (json.getValue("serviceId") instanceof String) {
     obj.setApiId((String) json.getValue("serviceId"));
   }
   if (json.getValue("serviceOrgId") instanceof String) {
     obj.setApiOrgId((String) json.getValue("serviceOrgId"));
   }
   if (json.getValue("serviceVersion") instanceof String) {
     obj.setApiVersion((String) json.getValue("serviceVersion"));
   }
   if (json.getValue("transportSecure") instanceof Boolean) {
     obj.setTransportSecure((Boolean) json.getValue("transportSecure"));
   }
   if (json.getValue("type") instanceof String) {
     obj.setType((String) json.getValue("type"));
   }
 }