public static void checkExpectedValues()

in src/main/java/com/amazonaws/services/dynamodbv2/transactions/TransactionDynamoDBFacade.java [154:178]


    public static void checkExpectedValues(Map<String, ExpectedAttributeValue> expectedValues, Map<String, AttributeValue> item) {
        for (Map.Entry<String, ExpectedAttributeValue> entry : expectedValues.entrySet()) {
            // if the attribute is expected to exist (null for isExists means
            // true)
            if ((entry.getValue().isExists() == null || entry.getValue().isExists() == true)
                    // but the item doesn't
                    && (item == null
                            // or the attribute doesn't
                            || item.get(entry.getKey()) == null
                            // or it doesn't have the expected value
                            || !expectedValueMatches(entry.getValue().getValue(), item.get(entry.getKey())))) {
                throw new ConditionalCheckFailedException(
                        "expected attribute(s) " + expectedValues
                                + " but found " + item);
            } else if (entry.getValue().isExists() != null
                    && !entry.getValue().isExists()
                    && item != null && item.get(entry.getKey()) != null) {
                // the attribute isn't expected to exist, but the item exists
                // and the attribute does too
                throw new ConditionalCheckFailedException(
                        "expected attribute(s) " + expectedValues
                                + " but found " + item);
            }
        }
    }