Skip to content

Commit fafd366

Browse files
committed
Showcase stereotyping.
1 parent eab855e commit fafd366

File tree

12 files changed

+418
-7
lines changed

12 files changed

+418
-7
lines changed

server/pom.xml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
1919
<bytebuddy.version>1.17.6</bytebuddy.version>
2020
<datasource-micrometer.version>1.1.0</datasource-micrometer.version>
2121
<java.version>21</java.version>
22-
<jmolecules.version>2025.0.0-SNAPSHOT</jmolecules.version>
22+
<jmolecules.version>2025.0.0-STEREOTYPE-SNAPSHOT</jmolecules.version>
2323
<spring-hateoas.version>3.0.0-SNAPSHOT</spring-hateoas.version>
2424
<spring-modulith.version>2.0.0-SNAPSHOT</spring-modulith.version>
2525

@@ -65,6 +65,21 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
6565
<artifactId>jmolecules-starter-ddd</artifactId>
6666
</dependency>
6767

68+
<dependency>
69+
<groupId>org.jmolecules</groupId>
70+
<artifactId>jmolecules-ddd</artifactId>
71+
</dependency>
72+
73+
<dependency>
74+
<groupId>org.jmolecules</groupId>
75+
<artifactId>jmolecules-hexagonal-architecture</artifactId>
76+
</dependency>
77+
78+
<dependency>
79+
<groupId>org.jmolecules.integrations</groupId>
80+
<artifactId>jmolecules-stereotype</artifactId>
81+
</dependency>
82+
6883
<dependency>
6984
<groupId>org.jmolecules.integrations</groupId>
7085
<artifactId>jmolecules-jpa</artifactId>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package de.odrotbohm.restbucks;
17+
18+
import org.jmolecules.stereotype.Stereotype;
19+
20+
/**
21+
* @author Oliver Drotbohm
22+
*/
23+
@Stereotype(groups = "restbucks")
24+
public interface DTO {}

server/src/main/java/de/odrotbohm/restbucks/order/Orders.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.List;
2222

2323
import org.jmolecules.ddd.integration.AssociationResolver;
24+
import org.jmolecules.ddd.types.Repository;
2425
import org.springframework.data.repository.CrudRepository;
2526
import org.springframework.data.repository.PagingAndSortingRepository;
2627
import org.springframework.data.repository.query.Param;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
@org.jmolecules.architecture.hexagonal.Application
12
@org.jspecify.annotations.NullMarked
23
package de.odrotbohm.restbucks.order;

server/src/main/java/de/odrotbohm/restbucks/payment/Payment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.jmolecules.ddd.types.AggregateRoot;
3333
import org.jmolecules.ddd.types.Association;
3434
import org.jmolecules.ddd.types.Identifier;
35+
import org.jmolecules.ddd.types.ValueObject;
3536
import org.springframework.util.Assert;
3637

3738
/**
@@ -81,7 +82,7 @@ public Receipt getReceipt() {
8182
* @author Oliver Gierke
8283
*/
8384
@Value
84-
public static class Receipt {
85+
public static class Receipt implements ValueObject {
8586

8687
private final LocalDateTime date;
8788
private final Association<Order, OrderIdentifier> order;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
@org.jmolecules.architecture.hexagonal.Application
12
@org.jspecify.annotations.NullMarked
23
package de.odrotbohm.restbucks.payment;
4+

server/src/main/java/de/odrotbohm/restbucks/payment/web/PaymentController.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717

1818
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.*;
1919

20+
import de.odrotbohm.restbucks.DTO;
2021
import de.odrotbohm.restbucks.order.Order;
2122
import de.odrotbohm.restbucks.order.Orders;
2223
import de.odrotbohm.restbucks.payment.CreditCardNumber;
2324
import de.odrotbohm.restbucks.payment.Payment;
24-
import de.odrotbohm.restbucks.payment.PaymentService;
2525
import de.odrotbohm.restbucks.payment.Payment.Receipt;
26+
import de.odrotbohm.restbucks.payment.PaymentService;
2627
import lombok.Data;
2728
import lombok.EqualsAndHashCode;
2829
import lombok.NonNull;
@@ -156,7 +157,7 @@ static class PaymentModel extends RepresentationModel<PaymentModel> {
156157

157158
@Value
158159
@RequiredArgsConstructor(onConstructor = @__(@JsonCreator))
159-
static class PaymentForm {
160+
public static class PaymentForm implements DTO {
160161
CreditCardNumber number;
161162
}
162163
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
@org.jmolecules.architecture.hexagonal.Port
12
@org.jspecify.annotations.NullMarked
23
package de.odrotbohm.restbucks.payment.web;
4+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@org.springframework.lang.NonNullApi
2+
@org.jmolecules.architecture.hexagonal.PrimaryAdapter
3+
package org.springsource.restbucks.payment.web;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"groups" : {
3+
"restbucks" : {
4+
"displayName" : "Restbucks",
5+
"type" : "design"
6+
}
7+
}
8+
}

0 commit comments

Comments
 (0)