[SDC] code rebase for sdc resync to LF
[sdc.git] / common-app-api / src / main / java / org / openecomp / sdc / common / util / JsonUtils.java
index 30d70cd..367b806 100644 (file)
@@ -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());
+       }
+
 }