Operations, requests and responses changes - Amazon SDK for Java 2.x
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Operations, requests and responses changes

In v2.x of the SDK for Java, requests are passed to a client operation. For example DynamoDbClient's PutItemRequest is passed to DynamoDbClient.putItem operation. These operations return a response from the Amazon Web Services service, such as a PutItemResponse.

Version 2.x of the SDK for Java has the following changes from 1.x.

  • Operations with multiple response pages now have a Paginator method for automatically iterating over all items in the response.

  • You cannot mutate requests and responses.

  • You must create requests and responses with a static builder method instead of a constructor. For example, 1.x's new PutItemRequest().withTableName(...) is now PutItemRequest.builder().tableName(...).build().

  • Operations support a short-hand way to create requests: dynamoDbClient.putItem(request -> request.tableName(...)).