

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

# SDK for Java のバージョン 1 とバージョン 2 の Fluent セッターの違い
<a name="dynamodb-migrate-fluent-setters"></a>

V1 の DynamoDB マッピング API では Fluent セッターを持つ POJO を使用でき、V2 でもバージョン 2.30.29 以降で使用できます。

たとえば、次の 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 を使用する場合、`setName` は `null` の `name` 値を持つ `Customer` インスタンスを返します。

```
// 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.
  }
}
```