package io.vertx.amqp;
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;
public class AmqpSenderOptionsConverter {
public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, AmqpSenderOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "autoDrained":
if (member.getValue() instanceof Boolean) {
obj.setAutoDrained((Boolean)member.getValue());
}
break;
case "capabilities":
if (member.getValue() instanceof JsonArray) {
java.util.ArrayList<java.lang.String> list = new java.util.ArrayList<>();
((Iterable<Object>)member.getValue()).forEach( item -> {
if (item instanceof String)
list.add((String)item);
});
obj.setCapabilities(list);
}
break;
case "capabilitys":
if (member.getValue() instanceof JsonArray) {
((Iterable<Object>)member.getValue()).forEach( item -> {
if (item instanceof String)
obj.addCapability((String)item);
});
}
break;
case "dynamic":
if (member.getValue() instanceof Boolean) {
obj.setDynamic((Boolean)member.getValue());
}
break;
case "linkName":
if (member.getValue() instanceof String) {
obj.setLinkName((String)member.getValue());
}
break;
}
}
}
public static void toJson(AmqpSenderOptions obj, JsonObject json) {
toJson(obj, json.getMap());
}
public static void toJson(AmqpSenderOptions obj, java.util.Map<String, Object> json) {
json.put("autoDrained", obj.isAutoDrained());
if (obj.getCapabilities() != null) {
JsonArray array = new JsonArray();
obj.getCapabilities().forEach(item -> array.add(item));
json.put("capabilities", array);
}
json.put("dynamic", obj.isDynamic());
if (obj.getLinkName() != null) {
json.put("linkName", obj.getLinkName());
}
}
}