Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Fluent setter: differenze tra la versione 1 e la versione 2 dell'SDK for Java
È possibile utilizzarlo POJOs con i setter fluenti nell'API di mappatura DynamoDB per V1 e con V2 a partire dalla versione 2.30.29.
Ad esempio, il seguente POJO restituisce un'istanza del metodo: Customer
setName
// 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; } }
Tuttavia, se si utilizza una versione della V2 precedente alla 2.30.29, setName
restituisce un'Customer
istanza con un valore di. 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. } }