Skip to content
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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

renanfranca
Copy link
Contributor

@renanfranca renanfranca commented Jan 14, 2025


import tech.jhipster.lite.shared.error.domain.Assert;

public record JHipsterModuleRank(String rank) {
Copy link
Contributor

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) {
Copy link
Member

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;
Copy link
Member

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")));
Copy link
Member

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);

@renanfranca
Copy link
Contributor Author

Thank you for the reviews. I will work on this tomorrow ✌️😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants