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;
 
Full parameter specification for the Query API.
 
 public class QuerySpec extends AbstractCollectionSpec<QueryRequest> {
     private KeyAttribute hashKey;
     private Collection<QueryFilterqueryFilters;
     private Map<StringStringnameMap;
     private Map<StringObjectvalueMap;
 
 
     public QuerySpec() {
         super(new QueryRequest());
     }
 
     public KeyAttribute getHashKey() {
         return ;
     }
 
     public QuerySpec withHashKey(KeyAttribute hashKey) {
         this. = hashKey;
         return this;
     }
 
     public QuerySpec withHashKey(String hashKeyNameObject hashKeyValue) {
         this. = new KeyAttribute(hashKeyNamehashKeyValue);
         return this;
     }
 
         return ;
     }
 
     public QuerySpec withRangeKeyCondition(RangeKeyCondition rangeKeyCondition) {
         this. = rangeKeyCondition;
         return this;
     }

    
When a key condition expression is specified, the corresponding name-map and value-map can optionally be specified via withNameMap(java.util.Map) and withValueMap(java.util.Map). (Note the hash key and range key conditions must not be specified if a key condition expression has been specified.)
 
     public QuerySpec withKeyConditionExpression(String keyConditionExpression) {
         getRequest().withKeyConditionExpression(keyConditionExpression);
         return this;
     }
 
     public String getKeyConditionExpression() {
         return getRequest().getKeyConditionExpression();
     }
 
     public QuerySpec withAttributesToGet(String... attributes) {
         getRequest().withAttributesToGet(Arrays.asList(attributes));
         return this;
     }
 
     public List<StringgetAttributesToGet() {
        return getRequest().getAttributesToGet();
    }
        getRequest().withConditionalOperator(op);
        return this;
    }
    public String getConditionalOperator() {
        return getRequest().getConditionalOperator();
    }
    public QuerySpec withConsistentRead(boolean consistentRead) {
        getRequest().setConsistentRead(consistentRead);
        return this;
    }
    public boolean isConsistentRead() {
        return getRequest().isConsistentRead();
    }
    public QuerySpec withQueryFilters(QueryFilter... queryFilters) {
        if (queryFilters == null)
            this. = null;
        else {
            Set<Stringnames = new LinkedHashSet<String>();
            for (QueryFilter equeryFilters)
                names.add(e.getAttribute());
            if (names.size() != queryFilters.length) {
                throw new IllegalArgumentException(
                    "attribute names must not duplicate in the list of query filters");
            }
            this. = Arrays.asList(queryFilters);
        }
        return this;
    }
        return ;
    }

    
When a filter expression is specified, the corresponding name-map and value-map can optionally be specified via withNameMap(java.util.Map) and withValueMap(java.util.Map). (Note query filters must not be specified if a filter expression has been specified.)
    public QuerySpec withFilterExpression(String filterExpression) {
        getRequest().withFilterExpression(filterExpression);
        return this;
    }
    public String getFilterExpression() {
        return getRequest().getFilterExpression();
    }

    
When a projection expression is specified, the corresponding name-map and value-map can optionally be specified via withNameMap(java.util.Map) and withValueMap(java.util.Map). (Note attributes-to-get must not be specified if a projection expression has been specified.)
    public QuerySpec withProjectionExpression(String projectionExpression) {
        getRequest().withProjectionExpression(projectionExpression);
        return this;
    }
    public String getProjectionExpression() {
        return getRequest().getProjectionExpression();
    }
    public Map<StringStringgetNameMap() {
        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 QuerySpec withNameMap(Map<StringStringnameMap) {
        if (nameMap == null)
            this. = null;
        else
            this. = Collections.unmodifiableMap(new LinkedHashMap<StringString>(nameMap));
        return this;
    }
    public Map<StringObjectgetValueMap() {
        return ;
    }

    
Applicable only when an expression has been specified. Used to specify the actual values for the attribute-value placeholders.
    public QuerySpec withValueMap(Map<StringObjectvalueMap) {
        if (valueMap == null)
            this. = null;
        else
            this. = Collections.unmodifiableMap(new LinkedHashMap<StringObject>(valueMap));
        return this;
    }
    public String getReturnConsumedCapacity() {
        return getRequest().getReturnConsumedCapacity();
    }
            ReturnConsumedCapacity returnConsumedCapacity) {
        getRequest().setReturnConsumedCapacity(returnConsumedCapacity);
        return this;
    }
    public QuerySpec withScanIndexForward(boolean scanIndexForward) {
        getRequest().withScanIndexForward(scanIndexForward);
        return this;
    }
    public boolean isScanIndexForward() {
        return getRequest().isScanIndexForward();
    }
    public QuerySpec withSelect(Select select) {
        getRequest().withSelect(select);
        return this;
    }
    public String getSelect() {
        return getRequest().getSelect();
    }
    // Exclusive start key
        return ;
    }
    public QuerySpec withExclusiveStartKey(KeyAttribute... exclusiveStartKey) {
        if (exclusiveStartKey == null)
            this. = null;
        else
            this. = Arrays.asList(exclusiveStartKey);
        return this;
    }
    public QuerySpec 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 QuerySpec withMaxResultSize(Integer maxResultSize) {
        setMaxResultSize(maxResultSize);
        return this;
    }
    @Override
    public QuerySpec withMaxResultSize(int maxResultSize) {
        setMaxResultSize(maxResultSize);
        return this;
    }
    @Override
    public QuerySpec withMaxPageSize(Integer maxPageSize) {
        setMaxPageSize(maxPageSize);
        return this;
    }
    @Override
    public QuerySpec withMaxPageSize(int maxPageSize) {
        setMaxPageSize(maxPageSize);
        return this;
    }
    @Override
    public QuerySpec 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.QueryExpressionSpec.
    @Beta
              .withFilterExpression(xspec.getFilterExpression())
              .withProjectionExpression(xspec.getProjectionExpression())
              .withNameMap(xspec.getNameMap())
              .withValueMap(xspec.getValueMap())
              ;
    }
New to GrepCode? Check out our FAQ X