-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: aligning view store sample #118
base: java-spi
Are you sure you want to change the base?
Conversation
aludwiko
commented
Dec 27, 2024
- package structure
- Endpoints instead of direct component calls
- removing remaining direct component calls docs
@@ -1,19 +1,19 @@ | |||
package store.view.joined; | |||
package store.order.view.joined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've decided to keep a separate "view" package, because that's what we want to highlight in this sample.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Get("/joined-by-customer/{customerId}") | ||
public CompletionStage<JoinedCustomerOrdersView.CustomerOrders> joinedByCustomer(String customerId) { | ||
return componentClient.forView() | ||
.method(JoinedCustomerOrdersView::get) | ||
.invokeAsync(customerId); | ||
} | ||
|
||
@Get("/nested-by-customer/{customerId}") | ||
public CompletionStage<CustomerOrders> nestedByCustomer(String customerId) { | ||
return componentClient.forView() | ||
.method(NestedCustomerOrdersView::get) | ||
.invokeAsync(customerId); | ||
} | ||
|
||
@Get("/structured-by-customer/{customerId}") | ||
public CompletionStage<store.order.view.structured.CustomerOrders> structuredByCustomer(String customerId) { | ||
return componentClient.forView() | ||
.method(StructuredCustomerOrdersView::get) | ||
.invokeAsync(customerId); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only part that doesn't read so well to me, with importing the different CustomerOrders
in different ways — directly, nested class, full package. Could be be better to prefix each of those classes instead:
public CompletionStage<JoinedCustomerOrders> joinedByCustomer(String customerId)
public CompletionStage<NestedCustomerOrders> nestedByCustomer(String customerId)
public CompletionStage<StructuredCustomerOrders> structuredByCustomer(String customerId)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, fixed