Example usage for com.amazonaws.services.dynamodbv2.model GetItemRequest setExpressionAttributeNames

List of usage examples for com.amazonaws.services.dynamodbv2.model GetItemRequest setExpressionAttributeNames

Introduction

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

Prototype


public void setExpressionAttributeNames(java.util.Map<String, String> expressionAttributeNames) 

Source Link

Document

One or more substitution tokens for attribute names in an expression.

Usage

From source file:org.iternine.jeppetto.dao.dynamodb.DynamoDBQueryModelDAO.java

License:Apache License

@Override
public T findById(ID id) throws NoSuchItemException, JeppettoException {
    GetItemResult result;//from w w w.  j a  v  a  2  s  .  co m

    try {
        GetItemRequest getItemRequest = new GetItemRequest(tableName, getKeyFrom(id), consistentRead);

        getItemRequest.setProjectionExpression(projectionExpression);

        if (!projectionExpressionNames.isEmpty()) {
            getItemRequest.setExpressionAttributeNames(projectionExpressionNames);
        }

        result = dynamoDB.getItem(getItemRequest);
    } catch (AmazonClientException e) {
        throw new JeppettoException(e);
    }

    if (result.getItem() == null) {
        throw new NoSuchItemException(entityClass.getSimpleName(), id.toString());
    }

    T t = ConversionUtil.getObjectFromItem(result.getItem(), entityClass);

    ((DynamoDBPersistable) t).__markPersisted(dynamoDB.toString());

    return t;
}