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

io.vertx.ext.auth.KeyStoreOptionsConverter Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR5
Show newest version
package io.vertx.ext.auth;

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.auth.KeyStoreOptions}.
 * NOTE: This class has been automatically generated from the {@link io.vertx.ext.auth.KeyStoreOptions} original class using Vert.x codegen.
 */
public class KeyStoreOptionsConverter {

   static void fromJson(Iterable> json, KeyStoreOptions obj) {
    for (java.util.Map.Entry member : json) {
      switch (member.getKey()) {
        case "type":
          if (member.getValue() instanceof String) {
            obj.setType((String)member.getValue());
          }
          break;
        case "provider":
          if (member.getValue() instanceof String) {
            obj.setProvider((String)member.getValue());
          }
          break;
        case "password":
          if (member.getValue() instanceof String) {
            obj.setPassword((String)member.getValue());
          }
          break;
        case "path":
          if (member.getValue() instanceof String) {
            obj.setPath((String)member.getValue());
          }
          break;
        case "passwordProtection":
          if (member.getValue() instanceof JsonObject) {
            java.util.Map map = new java.util.LinkedHashMap<>();
            ((Iterable>)member.getValue()).forEach(entry -> {
              if (entry.getValue() instanceof String)
                map.put(entry.getKey(), (String)entry.getValue());
            });
            obj.setPasswordProtection(map);
          }
          break;
      }
    }
  }

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

   static void toJson(KeyStoreOptions obj, java.util.Map json) {
    if (obj.getType() != null) {
      json.put("type", obj.getType());
    }
    if (obj.getProvider() != null) {
      json.put("provider", obj.getProvider());
    }
    if (obj.getPassword() != null) {
      json.put("password", obj.getPassword());
    }
    if (obj.getPath() != null) {
      json.put("path", obj.getPath());
    }
    if (obj.getPasswordProtection() != null) {
      JsonObject map = new JsonObject();
      obj.getPasswordProtection().forEach((key, value) -> map.put(key, value));
      json.put("passwordProtection", map);
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy