-
Notifications
You must be signed in to change notification settings - Fork 37
Streaming methods #68
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
base: master
Are you sure you want to change the base?
Conversation
ae3d143
to
1098000
Compare
86946b7
to
50481b5
Compare
@wing328 any thoughts on this or other changes like this that improve the interface on JsonNullable? |
Thanks for the PR and sorry for late reply,. We're looking for maintainers: #71 Let me know if you're interesting in maintaining this project. Thank you. |
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.
Thanks for the PR. This looks great. There are two small suggestions.
* | ||
* @since 0.2.8 | ||
*/ | ||
public JsonNullable<T> filter( Predicate<T> predicate ) { |
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.
This method seems to be indented with two spaces instead of four.
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.
This should be fixed. Is 4 spaces the project standard? Should I fix the indenting on the test as well?
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.
I don’t know off hand. You could probably just check a few existing files and match whatever they have. I’m not aware of anything enforcing it, so it’s possible there’s already a mix.
For existing files, match whatever that file uses. For new files, match the project standard (if it exists).
@@ -0,0 +1,421 @@ | |||
/* |
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.
I didn’t notice the copyright in any other files (maybe I missed some).
Are you ok with removing this? I don’t exactly know the difference whether you add this or not though. I assume you’re the copyright holder either way. (…I’m not a lawyer though, so I could be completely wrong.)
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.
I can drop this, if it makes things better for the project.
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.
Honestly, I just don't know the implications. @wing328 might be able to provide some guidance?
src/main/java/org/openapitools/jackson/nullable/JsonNullable.java
Outdated
Show resolved
Hide resolved
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.
Mostly minor changes. If you aren't able to get to these, let us know and we can create a new PR with the required changes.
I think I have time to get to these changes tonight. |
@nrayburn-tech I haven't made the changes yet, but there is now testing that shows exactly where this implementation does not match an equivalent call on Optional. The build will skip comparisons with Optional methods that are not present in the current JDK. Building with Java 17 will show all the issues. The following all need NullPointerExceptions:
I am going to rework testing of ifPresentOrElse to make sure that is consistent as well. |
@nrayburn-tech I think I have the changes you asked for completed. Items still open:
I would like to squash this history down and get rebased on master (it looks like the pom.xml cannot merge) before this gets accepted. |
After you merge in master, you’ll want to update your pom changes to match the existing format. Use a property for the version. |
@nrayburn-tech the project moved to JUnit 5 while this PR was open. I will have to rework the testing annotations. |
found in java.util.Optional. - isUndefined() - orElseGet(Supplier) - orElseThrow() - orElseThrow(Supplier) - ifPresentOrElse(Supplier, Runnable) - filter(Predicate) - map(Function) - flatMap(Function) - or(Supplier) - stream()
b2b3080
to
fbafe0f
Compare
@nrayburn-tech the tests for this are now reworked and history is squashed down. I still need to deal with this license header and possible indentation issue. |
This PR adds the streaming methods found on java.util.Optional to the JsonNullable type.
Methods added:
Fixes #7.
Fixes #65.