SDK for Java のバージョン 1 とバージョン 2 の違い - AWS SDK for Java 2.x

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

SDK for Java のバージョン 1 とバージョン 2 の違い

バージョン 2.30.29 以降、V1 の DynamoDB マッピング API のフルエントセッターと V2 で POJOs を使用できます。

たとえば、次の POJO は setNameメソッドからCustomerインスタンスを返します。

// V1 @DynamoDBTable(tableName ="Customer") public class Customer{ private String name; // Other attributes and methods not shown. public Customer setName(String name){ this.name = name; return this; } }

ただし、2.30.29 より前のバージョンの V2 を使用する場合、 は name の値を持つCustomerインスタンスsetNameを返しますnull

// V2 prior to version 2.30.29. @DynamoDbBean public class Customer{ private String name; // Other attributes and methods not shown. public Customer setName(String name){ this.name = name; return this; // Bug: returns this instance with a `name` value of `null`. } }
// Available in V2 since version 2.30.29. @DynamoDbBean public class Customer{ private String name; // Other attributes and methods not shown. public Customer setName(String name){ this.name = name; return this; // Returns this instance for method chaining with the `name` value set. } }