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

847 #1517

Merged
merged 7 commits into from Sep 12, 2020
Merged

847 #1517

merged 7 commits into from Sep 12, 2020

Conversation

vdlald
Copy link
Contributor

@vdlald vdlald commented Sep 3, 2020

Relates to #847

Pull request description

  • remove methods for test
  • remove boilerplate code via Lombok

public class App {

private static final Logger LOGGER = LoggerFactory.getLogger(App.class);

@Setter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use @Data instead of adding getter and setter to each field

Copy link
Contributor Author

@vdlald vdlald Sep 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I can, but it seemed to me that the annotation @Data is not quite suitable for the class App. Usually, the classes called App are needed to run an application. When I look at this class, I get the feeling that there is another class called Kingdom. I propose to move the fields king, castle, army and static class FactoryMaker from class App to a new class Kingdom (where I can use the annotation @Data) and in App to use an object of class Kingdom. This option seems cleaner to me. What do you think about it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you can do that as well

@vdlald vdlald requested a review from iluwatar September 6, 2020 08:50
@iluwatar
Copy link
Owner

iluwatar commented Sep 6, 2020

Please let me know when its ready for another review

@vdlald
Copy link
Contributor Author

vdlald commented Sep 7, 2020

Please let me know when its ready for another review

I made the request for review via github, a request did not reach you?

@vdlald
Copy link
Contributor Author

vdlald commented Sep 12, 2020

Need to be reviewed

@ravening
Copy link
Contributor

Need to be reviewed

Do you want till #1503 gets completed else the code will have boilerplate code for getters and setters

@vdlald
Copy link
Contributor Author

vdlald commented Sep 12, 2020

I removed lombok from the commit 2e36a11.

private King king;
private Castle castle;
private Army army;
private final Kingdom kingdom = new Kingdom();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can refactor it to

Supplier<Kingdom> kingdomSupplier = Kingdom::new

...

public Kingdom getKingdom() {
    return kingdomSupplier.get();
}

but its upto you

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand why. Can you explain it in more detail?

@iluwatar iluwatar added this to the 1.24.0 milestone Sep 12, 2020
@iluwatar iluwatar merged commit 5607a49 into iluwatar:master Sep 12, 2020
@iluwatar
Copy link
Owner

Many thanks for this improvement!

@all-contributors please add @vdlald for code

@allcontributors
Copy link
Contributor

@iluwatar

I've put up a pull request to add @vdlald! 🎉

@vdlald
Copy link
Contributor Author

vdlald commented Sep 12, 2020

Thanks!

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.

None yet

3 participants