Switch to jMolecules integrations 0.4.
To allow records to be used as Identifier implementations (xmolecules/jmolecules-integrations#43). Updated MongoDB and JDBC samples accordingly.
This commit is contained in:
committed by
Mark Paluch
parent
2de6e0383c
commit
3e71ec637c
@@ -20,7 +20,6 @@ import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import lombok.Value;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -47,7 +46,7 @@ public class Customer implements AggregateRoot<Customer, CustomerId> {
|
||||
|
||||
Assert.notNull(address, "Address must not be null!");
|
||||
|
||||
this.id = CustomerId.of(UUID.randomUUID());
|
||||
this.id = new CustomerId(UUID.randomUUID());
|
||||
|
||||
this.firstname = firstname;
|
||||
this.lastname = lastname;
|
||||
@@ -56,8 +55,5 @@ public class Customer implements AggregateRoot<Customer, CustomerId> {
|
||||
this.addresses.add(address);
|
||||
}
|
||||
|
||||
@Value(staticConstructor = "of")
|
||||
public static class CustomerId implements Identifier {
|
||||
private final UUID id;
|
||||
}
|
||||
public record CustomerId(UUID id) implements Identifier {}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import example.springdata.mongodb.customer.Customer.CustomerId;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.Value;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -44,7 +43,7 @@ public class Order implements AggregateRoot<Order, Order.OrderId> {
|
||||
|
||||
public Order(Customer customer) {
|
||||
|
||||
this.id = OrderId.of(UUID.randomUUID());
|
||||
this.id = new OrderId(UUID.randomUUID());
|
||||
this.customer = Association.forAggregate(customer);
|
||||
this.lineItems = new ArrayList<>();
|
||||
}
|
||||
@@ -58,13 +57,5 @@ public class Order implements AggregateRoot<Order, Order.OrderId> {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Value(staticConstructor = "of")
|
||||
public static class OrderId implements Identifier {
|
||||
|
||||
UUID orderId;
|
||||
|
||||
public static OrderId create() {
|
||||
return OrderId.of(UUID.randomUUID());
|
||||
}
|
||||
}
|
||||
public static record OrderId(UUID id) implements Identifier {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user