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

Overlap between com.mongodb.jee.util.JSON and com.mongodb.jee.util.JSON #6

Open
kennardconsulting opened this issue Aug 10, 2013 · 1 comment

Comments

@kennardconsulting
Copy link

The design of com.mongodb.jee.util.JSON seems a little confusing?

I understand you want to provide a "JSON helper but with Writer as parameter", but in doing so you have duplicated methods from com.mongodb.util.JSON. For example 'serialize( Object o )' and 'parse( String s )' are identical in both classes.

In a typical Mongo JEE setup, both classes will be available on the classpath. So doing 'Fix Imports' in your IDE will always present both options. It's not obvious which one to use, or which one to prefer. And, over time, their implementations may get out of sync.

Could you perhaps separate your com.mongodb.jee.util.JSON into a JSONWriterUtils class or something? Without the overlapping methods? Then there would be no ambiguity, and people could use the regular 'com.mongodb.util.JSON.parse' for most use cases.

Regards,

Richard.

@angelozerr
Copy link
Owner

Hi Richard,

I think the original JSON of teh Mongo Driver should to use Writer/Outputstream. See the issue that I have created at https://jira.mongodb.org/browse/JAVA-709

To manage streaming, Writer or Outputsream sould be used. I had to copy/paste the original JSON class which works with StringBuilder as parameter. Hope one day the driver will change the signature.

But if you have a better solution, don't hesitate to create a patch.

Regards Angelo

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

No branches or pull requests

2 participants