All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.knotx.fragments.action.library.http.options.HttpActionOptionsConverter Maven / Gradle / Ivy

package io.knotx.fragments.action.library.http.options;

import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import java.time.Instant;
import java.time.format.DateTimeFormatter;

/**
 * Converter for {@link io.knotx.fragments.action.library.http.options.HttpActionOptions}.
 * NOTE: This class has been automatically generated from the {@link io.knotx.fragments.action.library.http.options.HttpActionOptions} original class using Vert.x codegen.
 */
public class HttpActionOptionsConverter {

  public static void fromJson(Iterable> json, HttpActionOptions obj) {
    for (java.util.Map.Entry member : json) {
      switch (member.getKey()) {
        case "endpointOptions":
          if (member.getValue() instanceof JsonObject) {
            obj.setEndpointOptions(new io.knotx.fragments.action.library.http.options.EndpointOptions((JsonObject)member.getValue()));
          }
          break;
        case "httpMethod":
          if (member.getValue() instanceof String) {
            obj.setHttpMethod((String)member.getValue());
          }
          break;
        case "logLevel":
          if (member.getValue() instanceof String) {
            obj.setLogLevel((String)member.getValue());
          }
          break;
        case "requestTimeoutMs":
          if (member.getValue() instanceof Number) {
            obj.setRequestTimeoutMs(((Number)member.getValue()).longValue());
          }
          break;
        case "responseOptions":
          if (member.getValue() instanceof JsonObject) {
            obj.setResponseOptions(new io.knotx.fragments.action.library.http.options.ResponseOptions((JsonObject)member.getValue()));
          }
          break;
        case "webClientOptions":
          if (member.getValue() instanceof JsonObject) {
            obj.setWebClientOptions(new io.vertx.ext.web.client.WebClientOptions((JsonObject)member.getValue()));
          }
          break;
      }
    }
  }

  public static void toJson(HttpActionOptions obj, JsonObject json) {
    toJson(obj, json.getMap());
  }

  public static void toJson(HttpActionOptions obj, java.util.Map json) {
    if (obj.getEndpointOptions() != null) {
      json.put("endpointOptions", obj.getEndpointOptions().toJson());
    }
    if (obj.getHttpMethod() != null) {
      json.put("httpMethod", obj.getHttpMethod());
    }
    if (obj.getLogLevel() != null) {
      json.put("logLevel", obj.getLogLevel());
    }
    json.put("requestTimeoutMs", obj.getRequestTimeoutMs());
    if (obj.getResponseOptions() != null) {
      json.put("responseOptions", obj.getResponseOptions().toJson());
    }
    if (obj.getWebClientOptions() != null) {
      json.put("webClientOptions", obj.getWebClientOptions().toJson());
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy