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

io.vertx.ext.consul.EventConverter Maven / Gradle / Ivy

package io.vertx.ext.consul;

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

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

   static void fromJson(Iterable> json, Event obj) {
    for (java.util.Map.Entry member : json) {
      switch (member.getKey()) {
        case "id":
          if (member.getValue() instanceof String) {
            obj.setId((String)member.getValue());
          }
          break;
        case "name":
          if (member.getValue() instanceof String) {
            obj.setName((String)member.getValue());
          }
          break;
        case "payload":
          if (member.getValue() instanceof String) {
            obj.setPayload((String)member.getValue());
          }
          break;
        case "node":
          if (member.getValue() instanceof String) {
            obj.setNode((String)member.getValue());
          }
          break;
        case "service":
          if (member.getValue() instanceof String) {
            obj.setService((String)member.getValue());
          }
          break;
        case "tag":
          if (member.getValue() instanceof String) {
            obj.setTag((String)member.getValue());
          }
          break;
        case "version":
          if (member.getValue() instanceof Number) {
            obj.setVersion(((Number)member.getValue()).intValue());
          }
          break;
        case "lTime":
          if (member.getValue() instanceof Number) {
            obj.setLTime(((Number)member.getValue()).intValue());
          }
          break;
      }
    }
  }

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

   static void toJson(Event obj, java.util.Map json) {
    if (obj.getId() != null) {
      json.put("id", obj.getId());
    }
    if (obj.getName() != null) {
      json.put("name", obj.getName());
    }
    if (obj.getPayload() != null) {
      json.put("payload", obj.getPayload());
    }
    if (obj.getNode() != null) {
      json.put("node", obj.getNode());
    }
    if (obj.getService() != null) {
      json.put("service", obj.getService());
    }
    if (obj.getTag() != null) {
      json.put("tag", obj.getTag());
    }
    json.put("version", obj.getVersion());
    json.put("lTime", obj.getLTime());
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy