Example usage for com.amazonaws.services.dynamodbv2.xspec ExpressionSpecBuilder ExpressionSpecBuilder

List of usage examples for com.amazonaws.services.dynamodbv2.xspec ExpressionSpecBuilder ExpressionSpecBuilder

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.xspec ExpressionSpecBuilder ExpressionSpecBuilder.

Prototype

public ExpressionSpecBuilder() 

Source Link

Document

Constructs a request-centric Expression Specification Builder that can be used to construct valid expressions, and the respective name maps and value maps, for various DynamoDB requests in a typeful manner.

Usage

From source file:com.github.fge.jsonpatch.JsonPatch.java

License:LGPL

/**
 * Converts this JsonPatch into an ExpressionSpecBuilder
 * @return an expression spec builder that contains the updates contained in this
 * patch/*from   ww w  . ja va2 s  . c o  m*/
 */
public ExpressionSpecBuilder get() {
    ExpressionSpecBuilder builder = new ExpressionSpecBuilder();
    for (JsonPatchOperation operation : operations) {
        operation.applyToBuilder(builder);
    }
    return builder;
}

From source file:jp.classmethod.aws.dynamodb.DynamoDbRepository.java

License:Open Source License

@Override
public <S extends E> S update(S domain, VersionCondition condition) {
    Preconditions.checkNotNull(domain, "domain must not be null");
    final Item domainItem = convertDomainToItem(domain);
    Preconditions.checkArgument(domainItem.hasAttribute(hashKeyName),
            "hash key must be set in domain object when updating: " + hashKeyName);

    ExpressionSpecBuilder builder = new ExpressionSpecBuilder();
    builder.withCondition(ExpressionSpecBuilder.S(hashKeyName).exists());
    if (condition != null) {
        Preconditions.checkState(versionProperty != null);
        builder.withCondition(ExpressionSpecBuilder.N(versionProperty).eq(condition.getVersion()));
    }/*from  w w w  .  ja  v  a2s.c  o  m*/
    PutItemExpressionSpec xSpec = builder.buildForPut();
    PutItemSpec spec = new PutItemSpec().withItem(domainItem).withExpressionSpec(xSpec);
    try {
        table.putItem(spec);
    } catch (AmazonClientException e) {
        throw processUpdateItemException(getId(domain), e);
    }
    // PutItem does not accept ReturnValue.ALL_NEW
    return domain;
}