io.vertx.ext.web.api.generator.ApiHandlerUtils Maven / Gradle / Ivy
package io.vertx.ext.web.api.generator;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import java.util.Optional;
public class ApiHandlerUtils {
public static Object searchInJson(JsonObject obj, String key) {
if ("body".equals(key)) return obj.getValue("body");
if (obj.getJsonObject("path").containsKey(key)) return obj.getJsonObject("path").getValue(key);
if (obj.getJsonObject("query").containsKey(key)) return obj.getJsonObject("query").getValue(key);
if (obj.getJsonObject("header").containsKey(key)) return obj.getJsonObject("header").getValue(key);
if (obj.getJsonObject("cookie").containsKey(key)) return obj.getJsonObject("cookie").getValue(key);
if (obj.getJsonObject("form").containsKey(key)) return obj.getJsonObject("form").getValue(key);
return null;
}
public static Optional
© 2015 - 2025 Weber Informatics LLC | Privacy Policy