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;
Common base class for parameter specification that involves a primary key.
        extends AbstractSpec<T> {
    protected AbstractSpecWithPrimaryKey(T request) {
        super(request);
    }

    
Returns the primary key components that has been specified.
    public final Collection<KeyAttributegetKeyComponents() {
        return ;
    }

    
Sets the primary key with the specified key components.
    public AbstractSpecWithPrimaryKey<T> withPrimaryKey(KeyAttribute ... components) {
        if (components == null)
            this. = null;
        else
            this. = Arrays.asList(components);
        return this;
    }

    
Sets the primary key.
    public AbstractSpecWithPrimaryKey<T> withPrimaryKey(PrimaryKey primaryKey) {
        if (primaryKey == null)
            this. = null;
        else {
            this. = primaryKey.getComponents();
        }
        return this;
    }

    
Sets the primary key with the specified hash-only key name and value.
    public AbstractSpecWithPrimaryKey<T> withPrimaryKey(String hashKeyNameObject hashKeyValue) {
        if (hashKeyName == null)
            throw new IllegalArgumentException();
        withPrimaryKey(new PrimaryKey(hashKeyNamehashKeyValue));
        return this;
    }

    
Sets the primary key with the specified hash key and range key.
    public AbstractSpecWithPrimaryKey<T> withPrimaryKey(String hashKeyNameObject hashKeyValue,
            String rangeKeyNameObject rangeKeyValue) {
        if (hashKeyName == null)
            throw new IllegalArgumentException("Invalid hash key name");
        if (rangeKeyName == null)
            throw new IllegalArgumentException("Invalid range key name");
        if (hashKeyName.equals(rangeKeyName))
            throw new IllegalArgumentException("Names of hash and range keys must not be the same");
        withPrimaryKey(new PrimaryKey(hashKeyNamehashKeyValue
            rangeKeyNamerangeKeyValue));
        return this;
    }
New to GrepCode? Check out our FAQ X