-
-
Notifications
You must be signed in to change notification settings - Fork 215
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
add optional rank at modules domain #11724
base: main
Are you sure you want to change the base?
add optional rank at modules domain #11724
Conversation
renanfranca
commented
Jan 14, 2025
•
edited by pascalgrimaud
Loading
edited by pascalgrimaud
- related to New state for modules #10934
…ntic builder at JHipsterModuleResource.java
…uilder to not use Optional for rank
…the JHipsterModuleResourceBuilder
…ank at JHipsterModuleResource.java
|
||
import tech.jhipster.lite.shared.error.domain.Assert; | ||
|
||
public record JHipsterModuleRank(String rank) { |
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.
How about using an enum instead?
|
||
import tech.jhipster.lite.shared.error.domain.Assert; | ||
|
||
public record JHipsterModuleRank(String rank) { |
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.
as we already know the possible value, I would use an enum here: RANK_S, RANK_A, etc
@@ -14,6 +15,7 @@ public final class JHipsterModuleResource { | |||
private final JHipsterModuleApiDoc apiDoc; | |||
private final JHipsterModuleOrganization organization; | |||
private final JHipsterModuleTags tags; | |||
private final Optional<JHipsterModuleRank> rank; |
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.
no need to be optional here, as there is a default value to RANK_D
@@ -24,6 +26,7 @@ private JHipsterModuleResource(JHipsterModuleResourceBuilder builder) { | |||
apiDoc = builder.apiDoc; | |||
tags = builder.tags; | |||
organization = builder.organization; | |||
rank = Optional.ofNullable(builder.rank).or(() -> Optional.of(new JHipsterModuleRank("D"))); |
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.
would be something like Optional.ofNullable(builder.rank).orElse(JHipsterModuleRank.RANK_D);
Thank you for the reviews. I will work on this tomorrow ✌️😀 |