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.spec;
 
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
API for fully specifying all the parameters of a Table-centric Scan API.
 
 public class ScanSpec extends AbstractCollectionSpec<ScanRequest> {
     private Collection<ScanFilterscanFilters;
     private Map<StringStringnameMap;
     private Map<StringObjectvalueMap;
 
 
     public ScanSpec() {
         super(new ScanRequest());
     }
 
     public Collection<ScanFiltergetScanFilters() {
         return ;
     }
 
     public ScanSpec withScanFilters(ScanFilter... scanFilters) {
         if (scanFilters == null)
             this. = null;
         else {
             Set<Stringnames = new LinkedHashSet<String>();
             for (ScanFilter escanFilters)
                 names.add(e.getAttribute());
             if (names.size() != scanFilters.length) {
                 throw new IllegalArgumentException(
                     "attribute names must not duplicate in the list of scan filters");
             }
             this. = Arrays.asList(scanFilters);
         }
         return this;
     }

    
AND|OR that applies to all the conditions in the ScanFilters.
 
     public String getConditionalOperator() {
         return getRequest().getConditionalOperator();
     }
 
         getRequest().setConditionalOperator(op);
         return this;
     }
 
     public List<StringgetAttributesToGet() {
         return getRequest().getAttributesToGet();
     }
 
     public ScanSpec withAttributesToGet(String ... attributes) {
         if (attributes == null)
             getRequest().setAttributesToGet(null);
         else
             getRequest().setAttributesToGet(Arrays.asList(attributes));
         return this;
     }

    
Any query filters will be ignored if a filter expression has been specified. When a filter expression is specified, the corresponding name-map and value-map can also be specified via withNameMap(java.util.Map) and withValueMap(java.util.Map).
 
    public String getFilterExpression() {
        return getRequest().getFilterExpression();
    }
    public ScanSpec withFilterExpression(String filterExpression) {
        getRequest().setFilterExpression(filterExpression);
        return this;
    }
    public String getProjectionExpression() {
        return getRequest().getProjectionExpression();
    }
    public ScanSpec withProjectionExpression(String projectionExpression) {
        getRequest().setProjectionExpression(projectionExpression);
        return this;
    }
    public Map<String,StringgetNameMap() {
        return ;
    }

    
Applicable only when an expression has been specified. Used to specify the actual values for the attribute-name placeholders, where the value in the map can either be string for simple attribute name, or a JSON path expression.
    public ScanSpec withNameMap(Map<StringStringnameMap) {
        if (nameMap == null)
            this. = null;
        else
            this. = Collections.unmodifiableMap(new LinkedHashMap<StringString>(nameMap));
        return this;
    }
    public Map<String,ObjectgetValueMap() {
        return ;
    }

    
Applicable only when an expression has been specified. Used to specify the actual values for the attribute-value placeholders.
    public ScanSpec withValueMap(Map<StringObjectvalueMap) {
        if (valueMap == null)
            this. = null;
        else
            this. = Collections.unmodifiableMap(new LinkedHashMap<StringObject>(valueMap));
        return this;
    }
    public String getReturnConsumedCapacity() {
        return getRequest().getReturnConsumedCapacity();
    }
        getRequest().setReturnConsumedCapacity(capacity);
        return this;
    }

    
Specifies the attributes to be returned.
    // ALL_ATTRIBUTES | ALL_PROJECTED_ATTRIBUTES | SPECIFIC_ATTRIBUTES | COUNT
    public String getSelect() {
        return getRequest().getSelect();
    }
    public ScanSpec withSelect(Select select) {
        getRequest().setSelect(select);
        return this;
    }
    public Integer getSegment() {
        return getRequest().getSegment();
    }
    public ScanSpec withSegment(Integer segment) {
        getRequest().setSegment(segment);
        return this;
    }
    public Integer getTotalSegments() {
        return getRequest().getTotalSegments();
    }
    public ScanSpec withTotalSegments(Integer totalSegments) {
        getRequest().setTotalSegments(totalSegments);
        return this;
    }
    // Exclusive start key
        return ;
    }
    public ScanSpec withExclusiveStartKey(KeyAttribute... exclusiveStartKey) {
        if (exclusiveStartKey == null)
            this. = null;
        else
            this. = Arrays.asList(exclusiveStartKey);
        return this;
    }
    public ScanSpec withExclusiveStartKey(PrimaryKey exclusiveStartKey) {
        if (exclusiveStartKey == null)
            this. = null;
        else {
            this. = exclusiveStartKey.getComponents();
        }
        return this;
    }
            String hashKeyNameObject hashKeyValue) {
        return withExclusiveStartKey(new KeyAttribute(hashKeyNamehashKeyValue));
    }
            String hashKeyNameObject hashKeyValue,
            String rangeKeyNameObject rangeKeyValue) {
        return withExclusiveStartKey(
                new KeyAttribute(hashKeyNamehashKeyValue),
                new KeyAttribute(rangeKeyNamerangeKeyValue));
    }
    // Max result size
    @Override
    public ScanSpec withMaxResultSize(Integer maxResultSize) {
        setMaxResultSize(maxResultSize);
        return this;
    }
    @Override
    public ScanSpec withMaxResultSize(int maxResultSize) {
        setMaxResultSize(maxResultSize);
        return this;
    }
    @Override
    public ScanSpec withMaxPageSize(Integer maxPageSize) {
        setMaxPageSize(maxPageSize);
        return this;
    }
    @Override
    public ScanSpec withMaxPageSize(int maxPageSize) {
        setMaxPageSize(maxPageSize);
        return this;
    }
    @Override
    public ScanSpec withProgressListener(ProgressListener progressListener) {
        setProgressListener(progressListener);
        return this;
    }
    @Override
            RequestMetricCollector requestMetricCollector) {
        setRequestMetricCollector(requestMetricCollector);
        return this;
    }

    
Convenient method to specify expressions (and the associated name map and value map) via com.amazonaws.services.dynamodbv2.xspec.ScanExpressionSpec.
    @Beta
        return withFilterExpression(xspec.getFilterExpression())
              .withProjectionExpression(xspec.getProjectionExpression())
              .withNameMap(xspec.getNameMap())
              .withValueMap(xspec.getValueMap())
              ;
    }
New to GrepCode? Check out our FAQ X