Diferenças do Fluent Setters entre a versão 1 e a versão 2 do SDK for Java - AWS SDK for Java 2.x

As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.

Diferenças do Fluent Setters entre a versão 1 e a versão 2 do SDK for Java

Você pode usar POJOs com configuradores fluentes na API de mapeamento do DynamoDB para V1 e com V2 desde a versão 2.30.29.

Por exemplo, o POJO a seguir retorna uma Customer instância do setName método:

// 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; } }

No entanto, se você usar uma versão da V2 anterior à 2.30.29, setName retornará uma Customer instância com um valor de. name 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. } }