An easy to extend Java Object formatter that currently supports conversion between Jason and Java. Because of its core architecture, other formats can easily be added (XML is alread being worked on). Please read "Why JOFfree" in news area.
Be the first to post a text review of JOFfree ("free" Java Object Formatter). Rate and review a project by clicking thumbs up or thumbs down in the right column.
To any who download my code and try it out I would love to hear about your experience with it. Even if you want to tell me it sucks, I'm cool with it as long as you explain why. Thanks, and I hope you find it useful!
The JOFfree library converts a JSON string to Java object, or the reverse. So, why another JSON/Java parser? In short, a Java project I was working on was using JSON and I tried many of the libraries out there and all of them could either not be used on this project without unpleasant workarounds, or lacked needed features. This library is the result of my attempt to address those things I had problems with. I have tried to make it as simple as possible to use and extend, but am open to (and hope for) suggestions or patches. See the end of this overview for a code example. Currently, built in support is included for: All Java Primitive types Any class that implements java.util.Collection An class that implments java.util.Map java.util.Date, or any of it's subclasses java.lang.Float java.lang.Integer java.lang.Long java.lang.String The parser will first look for a converter that is an exact match for the object being parsed. If it cannot find one, It will check to see of there are converters for any of the Objects's super-classes, or any Interfaces it implements. If that fails, it will gracefully fail for just that Object (some libraries I've used would produce no output at all on any failure). Users may also register their own conversion objects to handle classes that are not handled by default, or override default functionality, by implementing JOFfreeConverter. Proxy objects created by http://cglib.sourceforge.net/apidocs/index.htm are supported. CGLIB is used by many projects including Hibernate and iBatis for their lazy load objects. Built in support for many more Object types, as well as abstracting the code that handles proxy objects so it can be extended to handle any proxy object is planned for the near future, as well as many other features (feel free to suggest any). Sample code: JOFfreeParser parser = new JOFfreeParser(); /* register a custom JOFfreeConverter */ SQLTimestampConverter converter = new SQLTimestampConverter(); parser.registerConverter(converter); /* to JSON */ String json = parser.unmarshall(myObject); /* to Java */ /* an existing MyObject may be used also, and the parser will * "fill in the blanks", or override values depending on what's * in the JSON string */ MyObject myObject = new MyObject(); myObject = (MyObject)parser.marshall(json, myObject);
Be the first person to add a text review.
Copyright © 2009 Geeknet, Inc. All rights reserved. Terms of Use
Thanks for your rating!
Would you also like to write a review?
Thanks for your review!
Get credit for your review by logging in via OpenID. Click your account provider: