|
|
|
@ -973,7 +973,7 @@ public class Criteria implements CriteriaDefinition { |
|
|
|
* @param right |
|
|
|
* @param right |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private boolean isEqual(Object left, Object right) { |
|
|
|
private boolean isEqual(@Nullable Object left, @Nullable Object right) { |
|
|
|
|
|
|
|
|
|
|
|
if (left == null) { |
|
|
|
if (left == null) { |
|
|
|
return right == null; |
|
|
|
return right == null; |
|
|
|
@ -993,42 +993,48 @@ public class Criteria implements CriteriaDefinition { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (left instanceof Document) { |
|
|
|
if (left instanceof Document) { |
|
|
|
|
|
|
|
|
|
|
|
if (!(right instanceof Document)) { |
|
|
|
if (!(right instanceof Document)) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Document leftDocument = (Document) left; |
|
|
|
Document leftDocument = (Document) left; |
|
|
|
Document rightDocument = (Document) right; |
|
|
|
Document rightDocument = (Document) right; |
|
|
|
Iterator leftIterator = leftDocument.entrySet().iterator(); |
|
|
|
Iterator<Entry<String, Object>> leftIterator = leftDocument.entrySet().iterator(); |
|
|
|
Iterator rightIterator = rightDocument.entrySet().iterator(); |
|
|
|
Iterator<Entry<String, Object>> rightIterator = rightDocument.entrySet().iterator(); |
|
|
|
|
|
|
|
|
|
|
|
while (leftIterator.hasNext() && rightIterator.hasNext()) { |
|
|
|
while (leftIterator.hasNext() && rightIterator.hasNext()) { |
|
|
|
Map.Entry leftEntry = (Map.Entry)leftIterator.next(); |
|
|
|
|
|
|
|
Map.Entry rightEntry = (Map.Entry)rightIterator.next(); |
|
|
|
Map.Entry<String, Object> leftEntry = leftIterator.next(); |
|
|
|
if (!isEqual(leftEntry.getKey(), rightEntry.getKey())) { |
|
|
|
Map.Entry<String, Object> rightEntry = rightIterator.next(); |
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
if (!isEqual(leftEntry.getKey(), rightEntry.getKey()) |
|
|
|
if (!isEqual(leftEntry.getValue(), rightEntry.getValue())) { |
|
|
|
|| !isEqual(leftEntry.getValue(), rightEntry.getValue())) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return !leftIterator.hasNext() && !rightIterator.hasNext(); |
|
|
|
return !leftIterator.hasNext() && !rightIterator.hasNext(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (Collection.class.isAssignableFrom(left.getClass())) { |
|
|
|
if (Collection.class.isAssignableFrom(left.getClass())) { |
|
|
|
|
|
|
|
|
|
|
|
if (!Collection.class.isAssignableFrom(right.getClass())) { |
|
|
|
if (!Collection.class.isAssignableFrom(right.getClass())) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Collection leftCollection = (Collection) left; |
|
|
|
Collection<?> leftCollection = (Collection<?>) left; |
|
|
|
Collection rightCollection = (Collection) right; |
|
|
|
Collection<?> rightCollection = (Collection<?>) right; |
|
|
|
Iterator leftIterator = leftCollection.iterator(); |
|
|
|
Iterator<?> leftIterator = leftCollection.iterator(); |
|
|
|
Iterator rightIterator = rightCollection.iterator(); |
|
|
|
Iterator<?> rightIterator = rightCollection.iterator(); |
|
|
|
|
|
|
|
|
|
|
|
while (leftIterator.hasNext() && rightIterator.hasNext()) { |
|
|
|
while (leftIterator.hasNext() && rightIterator.hasNext()) { |
|
|
|
|
|
|
|
|
|
|
|
if (!isEqual(leftIterator.next(), rightIterator.next())) { |
|
|
|
if (!isEqual(leftIterator.next(), rightIterator.next())) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return !leftIterator.hasNext() && !rightIterator.hasNext(); |
|
|
|
return !leftIterator.hasNext() && !rightIterator.hasNext(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|