Conversation
|
|
||
| import java.util.List; | ||
|
|
||
| public record BatchUpdate(List<DocumentBuilder> addOrUpdate, List<DocumentBuilder> delete) { |
There was a problem hiding this comment.
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 :) )
There was a problem hiding this comment.
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.
https://coveord.atlassian.net/browse/CDX-432