package io.vertx.core.net;
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;
Converter and mapper for PemTrustOptions
. NOTE: This class has been automatically generated from the PemTrustOptions
original class using Vert.x codegen. /**
* Converter and mapper for {@link io.vertx.core.net.PemTrustOptions}.
* NOTE: This class has been automatically generated from the {@link io.vertx.core.net.PemTrustOptions} original class using Vert.x codegen.
*/
public class PemTrustOptionsConverter {
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, PemTrustOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "certPaths":
if (member.getValue() instanceof JsonArray) {
((Iterable<Object>)member.getValue()).forEach( item -> {
if (item instanceof String)
obj.addCertPath((String)item);
});
}
break;
case "certValues":
if (member.getValue() instanceof JsonArray) {
((Iterable<Object>)member.getValue()).forEach( item -> {
if (item instanceof String)
obj.addCertValue(io.vertx.core.buffer.Buffer.buffer(JsonUtil.BASE64_DECODER.decode((String)item)));
});
}
break;
}
}
}
static void toJson(PemTrustOptions obj, JsonObject json) {
toJson(obj, json.getMap());
}
static void toJson(PemTrustOptions obj, java.util.Map<String, Object> json) {
if (obj.getCertPaths() != null) {
JsonArray array = new JsonArray();
obj.getCertPaths().forEach(item -> array.add(item));
json.put("certPaths", array);
}
if (obj.getCertValues() != null) {
JsonArray array = new JsonArray();
obj.getCertValues().forEach(item -> array.add(JsonUtil.BASE64_ENCODER.encodeToString(item.getBytes())));
json.put("certValues", array);
}
}
}