Example usage for com.amazonaws.services.dynamodbv2.document RangeKeyCondition le

List of usage examples for com.amazonaws.services.dynamodbv2.document RangeKeyCondition le

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.document RangeKeyCondition le.

Prototype

public RangeKeyCondition le(Object val) 

Source Link

Document

Creates and returns a condition of the range key being less than or equal to the given value.

Usage

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

License:Apache License

public static RangeKeyCondition build(final String attributeName, final Object value,
        final Operators comparisonOperator) {
    Check.isNotEmptyOrNull("attributeName", attributeName);
    Check.isNotNull("conditionValue", value);

    final RangeKeyCondition rangeKeyCondition = new RangeKeyCondition(attributeName);
    switch (comparisonOperator) {
    case EQUALS:/*from w  w  w . ja  v  a2  s. c o  m*/
        rangeKeyCondition.eq(value);
        break;
    case GREATER_THAN_OR_EQUALS:
        rangeKeyCondition.ge(value);
        break;
    case LESS_THAN_OR_EQUALS:
        rangeKeyCondition.le(value);
        break;
    default:
        throw new InvalidConditionOperatorException(String
                .format("Operation %s not valid for range key condition.", comparisonOperator.toString()));
    }

    return rangeKeyCondition;
}