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

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

There is a newer version: 5.0.0.CR5
Show 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.TxnKVOperation}.
 * NOTE: This class has been automatically generated from the {@link io.vertx.ext.consul.TxnKVOperation} original class using Vert.x codegen.
 */
public class TxnKVOperationConverter {

   static void fromJson(Iterable> json, TxnKVOperation obj) {
    for (java.util.Map.Entry member : json) {
      switch (member.getKey()) {
        case "type":
          if (member.getValue() instanceof String) {
            obj.setType(io.vertx.ext.consul.TxnKVVerb.valueOf((String)member.getValue()));
          }
          break;
        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 "flags":
          if (member.getValue() instanceof Number) {
            obj.setFlags(((Number)member.getValue()).longValue());
          }
          break;
        case "index":
          if (member.getValue() instanceof Number) {
            obj.setIndex(((Number)member.getValue()).longValue());
          }
          break;
        case "session":
          if (member.getValue() instanceof String) {
            obj.setSession((String)member.getValue());
          }
          break;
      }
    }
  }

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

   static void toJson(TxnKVOperation obj, java.util.Map json) {
    if (obj.getType() != null) {
      json.put("type", obj.getType().name());
    }
    if (obj.getKey() != null) {
      json.put("key", obj.getKey());
    }
    if (obj.getValue() != null) {
      json.put("value", obj.getValue());
    }
    json.put("flags", obj.getFlags());
    json.put("index", obj.getIndex());
    if (obj.getSession() != null) {
      json.put("session", obj.getSession());
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy