All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.dynamodb.model.BatchGetItemRequest Maven / Gradle / Ivy

Go to download

A single bundled dependency that includes all service and dependent JARs with third-party libraries relocated to different namespaces.

There is a newer version: 2.5.20
Show newest version
/*
 * Copyright 2013-2018 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 software.amazon.awssdk.services.dynamodb.model;

import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.utils.CollectionUtils;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Represents the input of a BatchGetItem operation. *

*/ @Generated("software.amazon.awssdk:codegen") public final class BatchGetItemRequest extends DynamoDbRequest implements ToCopyableBuilder { private final Map requestItems; private final String returnConsumedCapacity; private BatchGetItemRequest(BuilderImpl builder) { super(builder); this.requestItems = builder.requestItems; this.returnConsumedCapacity = builder.returnConsumedCapacity; } /** *

* A map of one or more table names and, for each table, a map that describes one or more items to retrieve from * that table. Each table name can be used only once per BatchGetItem request. *

*

* Each element in the map of items to retrieve consists of the following: *

*
    *
  • *

    * ConsistentRead - If true, a strongly consistent read is used; if false * (the default), an eventually consistent read is used. *

    *
  • *
  • *

    * ExpressionAttributeNames - One or more substitution tokens for attribute names in the * ProjectionExpression parameter. The following are some use cases for using * ExpressionAttributeNames: *

    *
      *
    • *

      * To access an attribute whose name conflicts with a DynamoDB reserved word. *

      *
    • *
    • *

      * To create a placeholder for repeating occurrences of an attribute name in an expression. *

      *
    • *
    • *

      * To prevent special characters in an attribute name from being misinterpreted in an expression. *

      *
    • *
    *

    * Use the # character in an expression to dereference an attribute name. For example, consider the following * attribute name: *

    *
      *
    • *

      * Percentile *

      *
    • *
    *

    * The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For * the complete list of reserved words, see Reserved Words in * the Amazon DynamoDB Developer Guide). To work around this, you could specify the following for * ExpressionAttributeNames: *

    *
      *
    • *

      * {"#P":"Percentile"} *

      *
    • *
    *

    * You could then use this substitution in an expression, as in this example: *

    *
      *
    • *

      * #P = :val *

      *
    • *
    * *

    * Tokens that begin with the : character are expression attribute values, which are placeholders for * the actual value at runtime. *

    *
    *

    * For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide. *

    *
  • *
  • *

    * Keys - An array of primary key attribute values that define specific items in the table. For each * primary key, you must provide all of the key attributes. For example, with a simple primary key, you only * need to provide the partition key value. For a composite key, you must provide both the partition key * value and the sort key value. *

    *
  • *
  • *

    * ProjectionExpression - A string that identifies one or more attributes to retrieve from the table. * These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must * be separated by commas. *

    *

    * If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are * not found, they will not appear in the result. *

    *

    * For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide. *

    *
  • *
  • *

    * AttributesToGet - This is a legacy parameter. Use ProjectionExpression instead. For * more information, see AttributesToGet in the Amazon DynamoDB Developer Guide. *

    *
  • *
*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

* * @return A map of one or more table names and, for each table, a map that describes one or more items to retrieve * from that table. Each table name can be used only once per BatchGetItem request.

*

* Each element in the map of items to retrieve consists of the following: *

*
    *
  • *

    * ConsistentRead - If true, a strongly consistent read is used; if * false (the default), an eventually consistent read is used. *

    *
  • *
  • *

    * ExpressionAttributeNames - One or more substitution tokens for attribute names in the * ProjectionExpression parameter. The following are some use cases for using * ExpressionAttributeNames: *

    *
      *
    • *

      * To access an attribute whose name conflicts with a DynamoDB reserved word. *

      *
    • *
    • *

      * To create a placeholder for repeating occurrences of an attribute name in an expression. *

      *
    • *
    • *

      * To prevent special characters in an attribute name from being misinterpreted in an expression. *

      *
    • *
    *

    * Use the # character in an expression to dereference an attribute name. For example, consider the * following attribute name: *

    *
      *
    • *

      * Percentile *

      *
    • *
    *

    * The name of this attribute conflicts with a reserved word, so it cannot be used directly in an * expression. (For the complete list of reserved words, see Reserved * Words in the Amazon DynamoDB Developer Guide). To work around this, you could specify the * following for ExpressionAttributeNames: *

    *
      *
    • *

      * {"#P":"Percentile"} *

      *
    • *
    *

    * You could then use this substitution in an expression, as in this example: *

    *
      *
    • *

      * #P = :val *

      *
    • *
    * *

    * Tokens that begin with the : character are expression attribute values, which are * placeholders for the actual value at runtime. *

    *
    *

    * For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide. *

    *
  • *
  • *

    * Keys - An array of primary key attribute values that define specific items in the table. For * each primary key, you must provide all of the key attributes. For example, with a simple primary * key, you only need to provide the partition key value. For a composite key, you must provide both * the partition key value and the sort key value. *

    *
  • *
  • *

    * ProjectionExpression - A string that identifies one or more attributes to retrieve from the * table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the * expression must be separated by commas. *

    *

    * If no attribute names are specified, then all attributes will be returned. If any of the requested * attributes are not found, they will not appear in the result. *

    *

    * For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide. *

    *
  • *
  • *

    * AttributesToGet - This is a legacy parameter. Use ProjectionExpression instead. * For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide. *

    *
  • */ public Map requestItems() { return requestItems; } /** * Returns the value of the ReturnConsumedCapacity property for this object. *

    * If the service returns an enum value that is not available in the current SDK version, * {@link #returnConsumedCapacity} will return {@link ReturnConsumedCapacity#UNKNOWN_TO_SDK_VERSION}. The raw value * returned by the service is available from {@link #returnConsumedCapacityAsString}. *

    * * @return The value of the ReturnConsumedCapacity property for this object. * @see ReturnConsumedCapacity */ public ReturnConsumedCapacity returnConsumedCapacity() { return ReturnConsumedCapacity.fromValue(returnConsumedCapacity); } /** * Returns the value of the ReturnConsumedCapacity property for this object. *

    * If the service returns an enum value that is not available in the current SDK version, * {@link #returnConsumedCapacity} will return {@link ReturnConsumedCapacity#UNKNOWN_TO_SDK_VERSION}. The raw value * returned by the service is available from {@link #returnConsumedCapacityAsString}. *

    * * @return The value of the ReturnConsumedCapacity property for this object. * @see ReturnConsumedCapacity */ public String returnConsumedCapacityAsString() { return returnConsumedCapacity; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(requestItems()); hashCode = 31 * hashCode + Objects.hashCode(returnConsumedCapacityAsString()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof BatchGetItemRequest)) { return false; } BatchGetItemRequest other = (BatchGetItemRequest) obj; return Objects.equals(requestItems(), other.requestItems()) && Objects.equals(returnConsumedCapacityAsString(), other.returnConsumedCapacityAsString()); } @Override public String toString() { return ToString.builder("BatchGetItemRequest").add("RequestItems", requestItems()) .add("ReturnConsumedCapacity", returnConsumedCapacityAsString()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "RequestItems": return Optional.ofNullable(clazz.cast(requestItems())); case "ReturnConsumedCapacity": return Optional.ofNullable(clazz.cast(returnConsumedCapacityAsString())); default: return Optional.empty(); } } public interface Builder extends DynamoDbRequest.Builder, CopyableBuilder { /** *

    * A map of one or more table names and, for each table, a map that describes one or more items to retrieve from * that table. Each table name can be used only once per BatchGetItem request. *

    *

    * Each element in the map of items to retrieve consists of the following: *

    *
      *
    • *

      * ConsistentRead - If true, a strongly consistent read is used; if false * (the default), an eventually consistent read is used. *

      *
    • *
    • *

      * ExpressionAttributeNames - One or more substitution tokens for attribute names in the * ProjectionExpression parameter. The following are some use cases for using * ExpressionAttributeNames: *

      *
        *
      • *

        * To access an attribute whose name conflicts with a DynamoDB reserved word. *

        *
      • *
      • *

        * To create a placeholder for repeating occurrences of an attribute name in an expression. *

        *
      • *
      • *

        * To prevent special characters in an attribute name from being misinterpreted in an expression. *

        *
      • *
      *

      * Use the # character in an expression to dereference an attribute name. For example, consider the * following attribute name: *

      *
        *
      • *

        * Percentile *

        *
      • *
      *

      * The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. * (For the complete list of reserved words, see Reserved Words * in the Amazon DynamoDB Developer Guide). To work around this, you could specify the following for * ExpressionAttributeNames: *

      *
        *
      • *

        * {"#P":"Percentile"} *

        *
      • *
      *

      * You could then use this substitution in an expression, as in this example: *

      *
        *
      • *

        * #P = :val *

        *
      • *
      * *

      * Tokens that begin with the : character are expression attribute values, which are placeholders * for the actual value at runtime. *

      *
      *

      * For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide. *

      *
    • *
    • *

      * Keys - An array of primary key attribute values that define specific items in the table. For * each primary key, you must provide all of the key attributes. For example, with a simple primary key, * you only need to provide the partition key value. For a composite key, you must provide both the * partition key value and the sort key value. *

      *
    • *
    • *

      * ProjectionExpression - A string that identifies one or more attributes to retrieve from the * table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the * expression must be separated by commas. *

      *

      * If no attribute names are specified, then all attributes will be returned. If any of the requested attributes * are not found, they will not appear in the result. *

      *

      * For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide. *

      *
    • *
    • *

      * AttributesToGet - This is a legacy parameter. Use ProjectionExpression instead. For * more information, see AttributesToGet in the Amazon DynamoDB Developer Guide. *

      *
    • *
    * * @param requestItems * A map of one or more table names and, for each table, a map that describes one or more items to * retrieve from that table. Each table name can be used only once per BatchGetItem * request.

    *

    * Each element in the map of items to retrieve consists of the following: *

    *
      *
    • *

      * ConsistentRead - If true, a strongly consistent read is used; if * false (the default), an eventually consistent read is used. *

      *
    • *
    • *

      * ExpressionAttributeNames - One or more substitution tokens for attribute names in the * ProjectionExpression parameter. The following are some use cases for using * ExpressionAttributeNames: *

      *
        *
      • *

        * To access an attribute whose name conflicts with a DynamoDB reserved word. *

        *
      • *
      • *

        * To create a placeholder for repeating occurrences of an attribute name in an expression. *

        *
      • *
      • *

        * To prevent special characters in an attribute name from being misinterpreted in an expression. *

        *
      • *
      *

      * Use the # character in an expression to dereference an attribute name. For example, consider * the following attribute name: *

      *
        *
      • *

        * Percentile *

        *
      • *
      *

      * The name of this attribute conflicts with a reserved word, so it cannot be used directly in an * expression. (For the complete list of reserved words, see Reserved * Words in the Amazon DynamoDB Developer Guide). To work around this, you could specify the * following for ExpressionAttributeNames: *

      *
        *
      • *

        * {"#P":"Percentile"} *

        *
      • *
      *

      * You could then use this substitution in an expression, as in this example: *

      *
        *
      • *

        * #P = :val *

        *
      • *
      * *

      * Tokens that begin with the : character are expression attribute values, which are * placeholders for the actual value at runtime. *

      *
      *

      * For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide. *

      *
    • *
    • *

      * Keys - An array of primary key attribute values that define specific items in the table. * For each primary key, you must provide all of the key attributes. For example, with a simple * primary key, you only need to provide the partition key value. For a composite key, you must provide * both the partition key value and the sort key value. *

      *
    • *
    • *

      * ProjectionExpression - A string that identifies one or more attributes to retrieve from * the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes * in the expression must be separated by commas. *

      *

      * If no attribute names are specified, then all attributes will be returned. If any of the requested * attributes are not found, they will not appear in the result. *

      *

      * For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide. *

      *
    • *
    • *

      * AttributesToGet - This is a legacy parameter. Use ProjectionExpression * instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide. *

      *
    • * @return Returns a reference to this object so that method calls can be chained together. */ Builder requestItems(Map requestItems); /** * Sets the value of the ReturnConsumedCapacity property for this object. * * @param returnConsumedCapacity * The new value for the ReturnConsumedCapacity property for this object. * @see ReturnConsumedCapacity * @return Returns a reference to this object so that method calls can be chained together. * @see ReturnConsumedCapacity */ Builder returnConsumedCapacity(String returnConsumedCapacity); /** * Sets the value of the ReturnConsumedCapacity property for this object. * * @param returnConsumedCapacity * The new value for the ReturnConsumedCapacity property for this object. * @see ReturnConsumedCapacity * @return Returns a reference to this object so that method calls can be chained together. * @see ReturnConsumedCapacity */ Builder returnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends DynamoDbRequest.BuilderImpl implements Builder { private Map requestItems = DefaultSdkAutoConstructMap.getInstance(); private String returnConsumedCapacity; private BuilderImpl() { } private BuilderImpl(BatchGetItemRequest model) { super(model); requestItems(model.requestItems); returnConsumedCapacity(model.returnConsumedCapacity); } public final Map getRequestItems() { return requestItems != null ? CollectionUtils.mapValues(requestItems, KeysAndAttributes::toBuilder) : null; } @Override public final Builder requestItems(Map requestItems) { this.requestItems = BatchGetRequestMapCopier.copy(requestItems); return this; } public final void setRequestItems(Map requestItems) { this.requestItems = BatchGetRequestMapCopier.copyFromBuilder(requestItems); } public final String getReturnConsumedCapacity() { return returnConsumedCapacity; } @Override public final Builder returnConsumedCapacity(String returnConsumedCapacity) { this.returnConsumedCapacity = returnConsumedCapacity; return this; } @Override public final Builder returnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity) { this.returnConsumedCapacity(returnConsumedCapacity.toString()); return this; } public final void setReturnConsumedCapacity(String returnConsumedCapacity) { this.returnConsumedCapacity = returnConsumedCapacity; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public BatchGetItemRequest build() { return new BatchGetItemRequest(this); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy