org.mule.common.metadata.parser.json
Class JSONUtils
java.lang.Object
org.mule.common.metadata.parser.json.JSONUtils
public abstract class JSONUtils
- extends Object
Utilities for manipulating and comparing JSON objects and arrays.
- Author:
- Timothy Danford
|
Method Summary |
static boolean |
isEqual(Object o1,
Object o2)
Determines whether two objects are equal, in a way that respects the isJSONObjectEqual() method
for JSONObjects. |
static boolean |
isJSONObjectEqual(org.json.JSONObject o1,
org.json.JSONObject o2)
Determines whether two JSONObjects are "equal," where equality is determined in a key-order-independent
manner. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JSONUtils
public JSONUtils()
isEqual
public static boolean isEqual(Object o1,
Object o2)
- Determines whether two objects are equal, in a way that respects the isJSONObjectEqual() method
for JSONObjects. It operates in the following manner:
- If the two objects are both JSONObjects, it calls isJSONObjectEqual().
- If they are JSONArrays, then it iteratively calls JSONUtils.isEqual() on each
successive element (returning false if the two arrays are of different lengths, or if any
of the successive pairs is unequal).
- If the two objects are of any other (pair of) types, it simple calls o1.isEqual(o2).
- Parameters:
o1 - The first object to compare.o2 - The second object to compare.
- Returns:
- True if the two objects satisfy the above conditions, false otherwise.
isJSONObjectEqual
public static boolean isJSONObjectEqual(org.json.JSONObject o1,
org.json.JSONObject o2)
- Determines whether two JSONObjects are "equal," where equality is determined in a key-order-independent
manner.
- Parameters:
o1 - o2 -
- Returns:
- If either object has a key that the other lacks, or if one object's key value returns false
when JSONUtils.isEqual() is called on that object, and given the other objects key value as the second
argument.
Copyright © 2015 MuleSoft, Inc.. All rights reserved.