Example usage for com.amazonaws.services.dynamodbv2.model AttributeValue equals

List of usage examples for com.amazonaws.services.dynamodbv2.model AttributeValue equals

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.model AttributeValue equals.

Prototype

@Override
    public boolean equals(Object obj) 

Source Link

Usage

From source file:com.clicktravel.infrastructure.persistence.aws.dynamodb.DynamoDbTemplate.java

License:Apache License

private Collection<String> getUpdateProperties(final Map<String, AttributeValue> previousItemAttributeMap,
        final Map<String, AttributeValue> newItemAttributeMap) {
    final Collection<String> updatedProperties = new ArrayList<>();
    for (final Entry<String, AttributeValue> entry : previousItemAttributeMap.entrySet()) {
        final String propertyName = entry.getKey();
        final AttributeValue previousAttributeValue = entry.getValue();
        final AttributeValue newAttributeValue = newItemAttributeMap.get(propertyName);
        boolean propertyUpdated = false;
        if (previousAttributeValue != null) {
            propertyUpdated = !previousAttributeValue.equals(newAttributeValue);
        } else {//  www  .j  a  va2 s  .  c  om
            propertyUpdated = newAttributeValue != null;
        }
        if (propertyUpdated) {
            updatedProperties.add(propertyName);
        }
    }
    return updatedProperties;
}