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

io.vertx.core.DeploymentOptionsConverter Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR1
Show newest version
package io.vertx.core;

import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.impl.JsonUtil;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.util.Base64;

/**
 * Converter and mapper for {@link io.vertx.core.DeploymentOptions}.
 * NOTE: This class has been automatically generated from the {@link io.vertx.core.DeploymentOptions} original class using Vert.x codegen.
 */
public class DeploymentOptionsConverter {


  private static final Base64.Decoder BASE64_DECODER = JsonUtil.BASE64_DECODER;
  private static final Base64.Encoder BASE64_ENCODER = JsonUtil.BASE64_ENCODER;

   static void fromJson(Iterable> json, DeploymentOptions obj) {
    for (java.util.Map.Entry member : json) {
      switch (member.getKey()) {
        case "config":
          if (member.getValue() instanceof JsonObject) {
            obj.setConfig(((JsonObject)member.getValue()).copy());
          }
          break;
        case "ha":
          if (member.getValue() instanceof Boolean) {
            obj.setHa((Boolean)member.getValue());
          }
          break;
        case "instances":
          if (member.getValue() instanceof Number) {
            obj.setInstances(((Number)member.getValue()).intValue());
          }
          break;
        case "maxWorkerExecuteTime":
          if (member.getValue() instanceof Number) {
            obj.setMaxWorkerExecuteTime(((Number)member.getValue()).longValue());
          }
          break;
        case "maxWorkerExecuteTimeUnit":
          if (member.getValue() instanceof String) {
            obj.setMaxWorkerExecuteTimeUnit(java.util.concurrent.TimeUnit.valueOf((String)member.getValue()));
          }
          break;
        case "threadingModel":
          if (member.getValue() instanceof String) {
            obj.setThreadingModel(io.vertx.core.ThreadingModel.valueOf((String)member.getValue()));
          }
          break;
        case "worker":
          if (member.getValue() instanceof Boolean) {
            obj.setWorker((Boolean)member.getValue());
          }
          break;
        case "workerPoolName":
          if (member.getValue() instanceof String) {
            obj.setWorkerPoolName((String)member.getValue());
          }
          break;
        case "workerPoolSize":
          if (member.getValue() instanceof Number) {
            obj.setWorkerPoolSize(((Number)member.getValue()).intValue());
          }
          break;
      }
    }
  }

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

   static void toJson(DeploymentOptions obj, java.util.Map json) {
    if (obj.getConfig() != null) {
      json.put("config", obj.getConfig());
    }
    json.put("ha", obj.isHa());
    json.put("instances", obj.getInstances());
    json.put("maxWorkerExecuteTime", obj.getMaxWorkerExecuteTime());
    if (obj.getMaxWorkerExecuteTimeUnit() != null) {
      json.put("maxWorkerExecuteTimeUnit", obj.getMaxWorkerExecuteTimeUnit().name());
    }
    if (obj.getThreadingModel() != null) {
      json.put("threadingModel", obj.getThreadingModel().name());
    }
    json.put("worker", obj.isWorker());
    if (obj.getWorkerPoolName() != null) {
      json.put("workerPoolName", obj.getWorkerPoolName());
    }
    json.put("workerPoolSize", obj.getWorkerPoolSize());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy