Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License").
  * You may not use this file except in compliance with the License.
  * A copy of the License is located at
  *
  *  http://aws.amazon.com/apache2.0
  *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
package com.amazonaws.services.dynamodbv2.document.internal;
The implementation for ScanApi.
public class ScanImpl extends AbstractImpl implements ScanApi {
    public ScanImpl(AmazonDynamoDB clientTable table) {
        super(clienttable);
    }
    @Override
    public ItemCollection<ScanOutcomescan(ScanFilter... scanFilters) {
        return doScan(new ScanSpec()
                .withScanFilters(scanFilters));
    }
    @Override
    public ItemCollection<ScanOutcomescan(String filterExpression,
            Map<StringStringnameMapMap<StringObjectvalueMap) {
        return doScan(new ScanSpec()
                .withFilterExpression(filterExpression)
                .withNameMap(nameMap)
                .withValueMap(valueMap));
    }
    @Override
    public ItemCollection<ScanOutcomescan(String filterExpression,
            String projectionExpressionMap<StringStringnameMap,
            Map<StringObjectvalueMap) {
        return doScan(new ScanSpec()
                .withFilterExpression(filterExpression)
                .withProjectionExpression(projectionExpression)
                .withNameMap(nameMap)
                .withValueMap(valueMap));
    }
    @Override
    public ItemCollection<ScanOutcomescan(ScanSpec spec) {
        return doScan(spec);
    }
    protected ItemCollection<ScanOutcomedoScan(ScanSpec spec) {
        // set the table name
        String tableName = getTable().getTableName();
        ScanRequest req = spec.getRequest().withTableName(tableName);
        // set up the start key, if any
        Collection<KeyAttributestartKey = spec.getExclusiveStartKey();
        if (startKey != null)
            req.setExclusiveStartKey(InternalUtils.toAttributeValueMap(startKey));
        // scan filters;
        Collection<ScanFilterfilters = spec.getScanFilters();
        if (filters != null) {
            req.setScanFilter(InternalUtils.toAttributeConditionMap(filters));
        }
        // set up the value map, if any (when expression API is used)
        final Map<String,AttributeValueattrValMap = InternalUtils.fromSimpleMap(spec.getValueMap());
        // set up expressions, if any
        req.withExpressionAttributeNames(spec.getNameMap())
           .withExpressionAttributeValues(attrValMap)
           ;
        return new ScanCollection(getClient(), spec);
    }
New to GrepCode? Check out our FAQ X