org.skyscreamer.jsonassert.comparator
Class JSONCompareUtil
java.lang.Object
org.skyscreamer.jsonassert.comparator.JSONCompareUtil
public final class JSONCompareUtil
- extends Object
Utility class that contains Json manipulation methods
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
arrayOfJsonObjectToMap
public static Map<Object,org.json.JSONObject> arrayOfJsonObjectToMap(org.json.JSONArray array,
String uniqueKey)
throws org.json.JSONException
- Throws:
org.json.JSONException
findUniqueKey
public static String findUniqueKey(org.json.JSONArray expected)
throws org.json.JSONException
- Throws:
org.json.JSONException
isUsableAsUniqueKey
public static boolean isUsableAsUniqueKey(String candidate,
org.json.JSONArray array)
throws org.json.JSONException
candidate is usable as a unique key if every element in the
array is a JSONObject having that key, and no two values are the same.
- Throws:
org.json.JSONException
jsonArrayToList
public static List<Object> jsonArrayToList(org.json.JSONArray expected)
throws org.json.JSONException
- Throws:
org.json.JSONException
allSimpleValues
public static boolean allSimpleValues(org.json.JSONArray array)
throws org.json.JSONException
- Throws:
org.json.JSONException
isSimpleValue
public static boolean isSimpleValue(Object o)
allJSONObjects
public static boolean allJSONObjects(org.json.JSONArray array)
throws org.json.JSONException
- Throws:
org.json.JSONException
allJSONArrays
public static boolean allJSONArrays(org.json.JSONArray array)
throws org.json.JSONException
- Throws:
org.json.JSONException
getKeys
public static Set<String> getKeys(org.json.JSONObject jsonObject)
qualify
public static String qualify(String prefix,
String key)
formatUniqueKey
public static String formatUniqueKey(String key,
String uniqueKey,
Object value)
getCardinalityMap
public static <T> Map<T,Integer> getCardinalityMap(Collection<T> coll)
Copyright © 2013. All Rights Reserved.