Skip to content

Commit

Permalink
Hacking.
Browse files Browse the repository at this point in the history
  • Loading branch information
odrotbohm committed Aug 31, 2021
1 parent 00c4411 commit d2b02f6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<dependency>
<groupId>org.jmolecules</groupId>
<artifactId>jmolecules-bom</artifactId>
<version>2021.0.2</version>
<version>2021.1.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public Drink(String name, Milk milk, Size size, MonetaryAmount price) {
}

@Value(staticConstructor = "of")
public static class DrinkIdentifier implements Identifier {
public static class DrinkIdentifier implements Identifier<Drink, DrinkIdentifier> {
String id;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
@Getter
@AllArgsConstructor
public class LineItem implements Entity<Order, LineItemIdentifier> {
public class LineItem implements Entity<Order, LineItemIdentifier, LineItem> {

private final LineItemIdentifier id;
private final String name;
Expand Down Expand Up @@ -68,7 +68,7 @@ LineItem increaseAmount() {
}

@Value(staticConstructor = "of")
public static class LineItemIdentifier implements Identifier {
public static class LineItemIdentifier implements Identifier<LineItem, LineItemIdentifier> {
UUID id;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public static enum Status {
}

@Value(staticConstructor = "of")
public static class OrderIdentifier implements Identifier {
public static class OrderIdentifier implements Identifier<Order, OrderIdentifier> {
String id;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
@Value(staticConstructor = "of")
@ValueObject
public class CreditCardNumber implements Identifier {
public class CreditCardNumber implements Identifier<CreditCard, CreditCardNumber> {

public static final String REGEX = "[0-9]{16}";
private static final Pattern PATTERN = Pattern.compile(REGEX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
@ToString
@NoArgsConstructor(force = true)
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public abstract class Payment<T extends AggregateRoot<T, PaymentIdentifier>>
implements AggregateRoot<T, PaymentIdentifier> {
public abstract class Payment<T extends AggregateRoot<T, PaymentIdentifier<T>>>
implements AggregateRoot<T, PaymentIdentifier<T>> {

private final PaymentIdentifier id;
private final PaymentIdentifier<T> id;

@Column(name = "rborder") //
private final Association<Order, OrderIdentifier> order;
Expand All @@ -62,7 +62,7 @@ protected Payment(Order order) {

Assert.notNull(order, "Order must not be null!");

this.id = PaymentIdentifier.of(UUID.randomUUID().toString());
this.id = new PaymentIdentifier<T>(UUID.randomUUID().toString());
this.order = Association.forAggregate(order);
this.paymentDate = LocalDateTime.now();
}
Expand All @@ -88,8 +88,9 @@ public static class Receipt {
private final Association<Order, OrderIdentifier> order;
}

@Value(staticConstructor = "of")
public static class PaymentIdentifier implements Identifier {
@Value
public static class PaymentIdentifier<T extends AggregateRoot<T, PaymentIdentifier<T>>>
implements Identifier<T, PaymentIdentifier<T>> {
String id;
}
}

0 comments on commit d2b02f6

Please sign in to comment.