File tree Expand file tree Collapse file tree 8 files changed +397
-5
lines changed
java/de/odrotbohm/restbucks
test/java/de/odrotbohm/restbucks Expand file tree Collapse file tree 8 files changed +397
-5
lines changed Original file line number Diff line number Diff line change 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 {}
Original file line number Diff line number Diff line change 2323
2424/**
2525 * Projection interface to render {@link Order} summaries.
26- *
26+ *
2727 * @author Oliver Gierke
2828 */
2929@ Projection (name = "summary" , types = Order .class )
Original file line number Diff line number Diff line change @@ -80,6 +80,8 @@ public Receipt getReceipt() {
8080 *
8181 * @author Oliver Gierke
8282 */
83+ // TODO: Cannot be a ValueObject as Spring Data REST filters association objects and we'd end up with only one
84+ // property to serialize, which would cause unwrapping into the EntityModel.
8385 @ Value
8486 public static class Receipt {
8587
Original file line number Diff line number Diff line change 2020
2121import java .util .Optional ;
2222
23+ import org .jmolecules .ddd .annotation .Service ;
24+
2325/**
2426 * Interface to collect payment services.
2527 *
2628 * @author Oliver Gierke
2729 */
30+ @ Service
2831public interface PaymentService {
2932
3033 /**
Original file line number Diff line number Diff line change 11@ org .jspecify .annotations .NullMarked
22package de .odrotbohm .restbucks .payment ;
3+
Original file line number Diff line number Diff line change 1717
1818import static org .springframework .hateoas .server .mvc .WebMvcLinkBuilder .*;
1919
20+ import de .odrotbohm .restbucks .DTO ;
2021import de .odrotbohm .restbucks .order .Order ;
2122import de .odrotbohm .restbucks .order .Orders ;
2223import de .odrotbohm .restbucks .payment .CreditCardNumber ;
2324import de .odrotbohm .restbucks .payment .Payment ;
24- import de .odrotbohm .restbucks .payment .PaymentService ;
2525import de .odrotbohm .restbucks .payment .Payment .Receipt ;
26+ import de .odrotbohm .restbucks .payment .PaymentService ;
2627import lombok .Data ;
2728import lombok .EqualsAndHashCode ;
2829import lombok .NonNull ;
@@ -156,7 +157,7 @@ static class PaymentModel extends RepresentationModel<PaymentModel> {
156157
157158 @ Value
158159 @ RequiredArgsConstructor (onConstructor = @ __ (@ JsonCreator ))
159- static class PaymentForm {
160+ static class PaymentForm implements DTO {
160161 CreditCardNumber number ;
161162 }
162163}
Original file line number Diff line number Diff line change 1+ {
2+ "groups" : {
3+ "restbucks" : {
4+ "displayName" : " Restbucks" ,
5+ "type" : " design"
6+ }
7+ }
8+ }
You can’t perform that action at this time.
0 commit comments