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

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

The newest version!
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.KeyValue}.
 * NOTE: This class has been automatically generated from the {@link io.vertx.ext.consul.KeyValue} original class using Vert.x codegen.
 */
public class KeyValueConverter {

   static void fromJson(Iterable> json, KeyValue obj) {
    for (java.util.Map.Entry member : json) {
      switch (member.getKey()) {
        case "key":
          if (member.getValue() instanceof String) {
            obj.setKey((String)member.getValue());
          }
          break;
        case "value":
          if (member.getValue() instanceof String) {
            obj.setValue((String)member.getValue());
          }
          break;
        case "session":
          if (member.getValue() instanceof String) {
            obj.setSession((String)member.getValue());
          }
          break;
        case "flags":
          if (member.getValue() instanceof Number) {
            obj.setFlags(((Number)member.getValue()).longValue());
          }
          break;
        case "createIndex":
          if (member.getValue() instanceof Number) {
            obj.setCreateIndex(((Number)member.getValue()).longValue());
          }
          break;
        case "modifyIndex":
          if (member.getValue() instanceof Number) {
            obj.setModifyIndex(((Number)member.getValue()).longValue());
          }
          break;
        case "lockIndex":
          if (member.getValue() instanceof Number) {
            obj.setLockIndex(((Number)member.getValue()).longValue());
          }
          break;
      }
    }
  }

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

   static void toJson(KeyValue obj, java.util.Map json) {
    if (obj.getKey() != null) {
      json.put("key", obj.getKey());
    }
    if (obj.getValue() != null) {
      json.put("value", obj.getValue());
    }
    if (obj.getSession() != null) {
      json.put("session", obj.getSession());
    }
    json.put("flags", obj.getFlags());
    json.put("createIndex", obj.getCreateIndex());
    json.put("modifyIndex", obj.getModifyIndex());
    json.put("lockIndex", obj.getLockIndex());
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy