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

Return ObjectNode from ObjectNode set-methods in order to allow better chaining #1781

Closed
wants to merge 1 commit into from

Conversation

timo-schmid
Copy link

A minor improvement for the API: When returning ObjectNode instead of JsonNode one can chain after calling set and setAll (with no downside that's obvious for me).

Without this, it's necessary to cast the resulting JsonNode to ObjectNode (which always works).

Greetings!

@cowtowncoder
Copy link
Member

Yes, from API perspective this would make sense.

Unfortunately it is also binary-compatibility breaking change that would literally break all existing code that calls these methods, because it changes method signature, and linker (code that loads in classes) would not find methods called by code that was compiled before the change.

Change can therefore not be made in Jackson 2.x at all (this change has been suggested multiple times). It may be made for 3.0, however. I will create separate issue for tracking this and related changes since there are other places as well.

@timo-schmid
Copy link
Author

Aha, I see. Thanks for the quick response!

@cowtowncoder cowtowncoder changed the title Return ObjectNode in order to allow better chaining Return ObjectNode from ObjectNode set-methods in order to allow better chaining Oct 9, 2017
@cowtowncoder
Copy link
Member

@timo-schmid Thank you contributing this -- I ended up changing this as part of 3.0 changes (forgot this patch would have separately done this), so this will be in 3.0.0.
Please let me know if there are other methods (I found one other in ArrayNode, but aside from that).

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

Successfully merging this pull request may close these issues.

None yet

2 participants