diff options
author | Michael Lando <ml636r@att.com> | 2017-08-02 19:57:39 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-08-02 19:57:39 +0000 |
commit | d1d771bed17c6a5beea19af8da0bf9113972f25a (patch) | |
tree | 6e7420dd3d82200849e51c2af3f2696f11815d12 /common-app-api | |
parent | f15292dd1b262f0a4300c3e7a5bdc5430a6f2a63 (diff) | |
parent | f5854fd32c19c44d32a3e6739b30271d4dccd393 (diff) |
Merge "[SDC] code rebase for sdc resync to LF"
Diffstat (limited to 'common-app-api')
-rw-r--r-- | common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java | 13 |
1 files changed, 13 insertions, 0 deletions
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()); + } + } |