Skip to content

Conversation

@olamothe
Copy link
Member

@olamothe olamothe commented Jul 1, 2021


import java.util.List;

public record BatchUpdate(List<DocumentBuilder> addOrUpdate, List<DocumentBuilder> delete) {
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL about Records. (https://www.baeldung.com/java-record-keyword). It's quite a neat feature.

Do you think there's place in the code where we should have used it? (ngl, I don't think that'd be worth the hassle but just knowing is good :) )

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes !

The only problem is that it does not entirely play well with the GSON library we use to encode/decode to JSON.

So I can't apply it everywhere blindly.

Encoding record with GSON should (or seems to) work, decoding records would explode, however.

For example. the FileContainer class in this PR could not use record because we need to decode the platform response with it.

But, as I'll be moving to write some tests this week, I'll refactor in some places to use record instead of standard classes.

@olamothe olamothe merged commit bb98f67 into main Jul 5, 2021
@y-lakhdar y-lakhdar deleted the CDX-432 branch June 15, 2023 18:21
This was referenced Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants