From f5854fd32c19c44d32a3e6739b30271d4dccd393 Mon Sep 17 00:00:00 2001 From: Avi Ziv Date: Mon, 31 Jul 2017 15:50:46 +0300 Subject: [SDC] code rebase for sdc resync to LF Change-Id: If6d87c9e324f508a8a6b80b10a03d1843901472e Signed-off-by: Michael Lando --- .../main/java/org/openecomp/sdc/common/util/JsonUtils.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'common-app-api') diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java index 30d70cd019..367b806104 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.common.util; import com.google.gson.JsonElement; +import com.google.gson.JsonObject; public class JsonUtils { @@ -42,4 +43,16 @@ public class JsonUtils { } + public static boolean containsEntry(JsonObject json, String key) { + return json.get(key) != null; + } + + public static boolean isEmptyJson(JsonObject json) { + return json.entrySet().isEmpty(); + } + + public static boolean isEmptyJson(JsonElement json) { + return json.isJsonPrimitive() ? false : JsonUtils.isEmptyJson(json.getAsJsonObject()); + } + } -- cgit 1.2.3-korg