#381 - Adapt examples to immutable object support.

Provide mutable property accessors to allow object mutation.
This commit is contained in:
Mark Paluch
2018-07-26 11:07:42 +02:00
parent e2d2bdf6bc
commit 1c56cf8fba
5 changed files with 29 additions and 14 deletions

View File

@@ -15,13 +15,13 @@
*/
package example.springdata.mongodb.aggregation;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.mongodb.core.mapping.Document;
@@ -31,16 +31,17 @@ import org.springframework.data.mongodb.core.mapping.Document;
*
* @author Thomas Darimont
* @author Oliver Gierke
* @author Mark Paluch
*/
@Data
@RequiredArgsConstructor(onConstructor = @__(@PersistenceConstructor))
@AllArgsConstructor(onConstructor = @__(@PersistenceConstructor))
@Document
public class Order {
private final String id;
private final String customerId;
private final Date orderDate;
private final List<LineItem> items;
private String id;
private String customerId;
private Date orderDate;
private List<LineItem> items;
/**
* Creates a new {@link Order} for the given customer id and order date.
@@ -49,7 +50,7 @@ public class Order {
* @param orderDate
*/
public Order(String customerId, Date orderDate) {
this(null, customerId, orderDate, new ArrayList<LineItem>());
this(null, customerId, orderDate, new ArrayList<>());
}
/**