Unit-tests were added if appropiate. "Passthrough"-methods to the underlying storage weren't tested if there are no additional edge-cases.
Javadoc was added, trying to mimic Collection/Map, but reduced to the actual exception cases.
Minar/breaking changes occur as discussed on the mailing list:
Signature change: JSONObject get(Object name) instead of JSONObject get(String name)
Return type / Signature change: void putAll(Map<? extends String, ? extends Object> newProperties) instead of JSONObject putAll(Map<String, ?> newProperties)
I've attached 21 patch files. Maybe I should've squashed it, but if anyone is interested in the evolution/idea behind the code, this way it would be easier to grasp it.
Added JSONTypeMismatchException and JSONValueNotFoundException. JSONObject behaviour improved by using opt() isntead of get for mor specific types, so we can actually use the new exceptions.
tapestry-json: JSONArray get() now throws IndexOutOfBoundsException
There's no reason to repackage the original exception into a RuntimeException.
To provide better interoperability with Java collections the JSONObject type now implements Map<String, Object>.
The needed changes are marginal:
putAll -> now returns void (breaking change)
Arguments for key are Object -> shouldn't be a problem
tapestry-json: added get
{type}
OrDefault methods to JSONObject
tapestry-json: make JSONArray a "real" Collection (wip)
tapestry-json: JSONArray improve javadoc
tapestry-json: JSONObject improve javadoc
ASF subversion and git services
added a comment - Commit 2dab8e0ad16c1ad690e08f9eb76fe2a42b187b3d in tapestry-5's branch refs/heads/master from Benjamin Weidig
[ https://gitbox.apache.org/repos/asf?p=tapestry-5.git;h=2dab8e0 ]
TAP5-2640 : tapestry-json improvements
(implement Collection/Map, better exceptions)
tapestry-json: added JSONTypeMismatchException
Added JSONTypeMismatchException and JSONValueNotFoundException. JSONObject behaviour improved by using opt() isntead of get for mor specific types, so we can actually use the new exceptions.
tapestry-json: JSONArray get() now throws IndexOutOfBoundsException
There's no reason to repackage the original exception into a RuntimeException.
tapestry-json: JSONTokener constructors exceptions improved
tapestry-json: improve JSONSpec tests
tapestry-json: better exception building
tapestry-json: added JSONSyntaxException
tapesty-json: javadoc updated
tapestry-json: JSONArray non-finite/nan check fixed
The constructor wasn't using checkedPut, even though the javadoc states that doubles are checked.
tapestry-json: javadoc typo
tapestry-json: added JSONArrayIndexOutOfBoundsException
tapestry-json: code style
tapestrsy-json: fix lossy conversion
tapestry-json: source formatting
tapestry-json: throw IllegalArgumentException on invalid doubles
tapestry-json: JSONObject implements Map<String, Object>
To provide better interoperability with Java collections the JSONObject type now implements Map<String, Object>.
The needed changes are marginal:
putAll -> now returns void (breaking change)
Arguments for key are Object -> shouldn't be a problem
tapestry-json: added get
{type}
OrDefault methods to JSONObject
tapestry-json: make JSONArray a "real" Collection (wip)
tapestry-json: JSONArray improve javadoc
tapestry-json: JSONObject improve javadoc
ASF subversion and git services
added a comment - Commit a1ba6d470808d9fb3588efc24e945ce01de1357c in tapestry-5's branch refs/heads/master from Thiago H. de Paula Figueiredo
[ https://gitbox.apache.org/repos/asf?p=tapestry-5.git;h=a1ba6d4 ]
TAP5-2640 : fixing JavaDoc errors.
Added JSONTypeMismatchException and JSONValueNotFoundException. JSONObject behaviour improved by using opt() isntead of get for mor specific types, so we can actually use the new exceptions.
tapestry-json: JSONArray get() now throws IndexOutOfBoundsException
There's no reason to repackage the original exception into a RuntimeException.
To provide better interoperability with Java collections the JSONObject type now implements Map<String, Object>.
The needed changes are marginal:
putAll -> now returns void (breaking change)
Arguments for key are Object -> shouldn't be a problem
tapestry-json: added get
{type}
OrDefault methods to JSONObject
tapestry-json: make JSONArray a "real" Collection (wip)
tapestry-json: JSONArray improve javadoc
tapestry-json: JSONObject improve javadoc
ASF subversion and git services
added a comment - Commit f68f13545422f2a7f41414706a148b1780ec56eb in tapestry-5's branch refs/heads/5.6.x from Benjamin Weidig
[ https://gitbox.apache.org/repos/asf?p=tapestry-5.git;h=f68f135 ]
TAP5-2640 : tapestry-json improvements
(implement Collection/Map, better exceptions)
tapestry-json: added JSONTypeMismatchException
Added JSONTypeMismatchException and JSONValueNotFoundException. JSONObject behaviour improved by using opt() isntead of get for mor specific types, so we can actually use the new exceptions.
tapestry-json: JSONArray get() now throws IndexOutOfBoundsException
There's no reason to repackage the original exception into a RuntimeException.
tapestry-json: JSONTokener constructors exceptions improved
tapestry-json: improve JSONSpec tests
tapestry-json: better exception building
tapestry-json: added JSONSyntaxException
tapesty-json: javadoc updated
tapestry-json: JSONArray non-finite/nan check fixed
The constructor wasn't using checkedPut, even though the javadoc states that doubles are checked.
tapestry-json: javadoc typo
tapestry-json: added JSONArrayIndexOutOfBoundsException
tapestry-json: code style
tapestrsy-json: fix lossy conversion
tapestry-json: source formatting
tapestry-json: throw IllegalArgumentException on invalid doubles
tapestry-json: JSONObject implements Map<String, Object>
To provide better interoperability with Java collections the JSONObject type now implements Map<String, Object>.
The needed changes are marginal:
putAll -> now returns void (breaking change)
Arguments for key are Object -> shouldn't be a problem
tapestry-json: added get
{type}
OrDefault methods to JSONObject
tapestry-json: make JSONArray a "real" Collection (wip)
tapestry-json: JSONArray improve javadoc
tapestry-json: JSONObject improve javadoc
ASF subversion and git services
added a comment - Commit 917e4719aed2c2f853fefc68207aa7249d87365f in tapestry-5's branch refs/heads/5.6.x from Thiago H. de Paula Figueiredo
[ https://gitbox.apache.org/repos/asf?p=tapestry-5.git;h=917e471 ]
TAP5-2640 : fixing JavaDoc errors.
For simpler usage with streams the class JSONCollectors provides static helper methods.
During testing it became clear that the default Map#merge(...) wasn't viable for the general JSONObject logic (exception on unknow keys), so it had to be overriden and adapted.
ASF subversion and git services
added a comment - Commit dbd66fdec13319e04ebf5d8a18db906f19ae7bf1 in tapestry-5's branch refs/heads/master from Benjamin Weidig
[ https://gitbox.apache.org/repos/asf?p=tapestry-5.git;h=dbd66fd ]
TAP5-2640 : Added JSONCollectors, modified JSONObject#merge
For simpler usage with streams the class JSONCollectors provides static helper methods.
During testing it became clear that the default Map#merge(...) wasn't viable for the general JSONObject logic (exception on unknow keys), so it had to be overriden and adapted.
Commit 2dab8e0ad16c1ad690e08f9eb76fe2a42b187b3d in tapestry-5's branch refs/heads/master from Benjamin Weidig
[ https://gitbox.apache.org/repos/asf?p=tapestry-5.git;h=2dab8e0 ]
TAP5-2640: tapestry-json improvements(implement Collection/Map, better exceptions)
tapestry-json: added JSONTypeMismatchException
Added JSONTypeMismatchException and JSONValueNotFoundException. JSONObject behaviour improved by using opt() isntead of get for mor specific types, so we can actually use the new exceptions.
tapestry-json: JSONArray get() now throws IndexOutOfBoundsException
There's no reason to repackage the original exception into a RuntimeException.
tapestry-json: JSONTokener constructors exceptions improved
tapestry-json: improve JSONSpec tests
tapestry-json: better exception building
tapestry-json: added JSONSyntaxException
tapesty-json: javadoc updated
tapestry-json: JSONArray non-finite/nan check fixed
The constructor wasn't using checkedPut, even though the javadoc states that doubles are checked.
tapestry-json: javadoc typo
tapestry-json: added JSONArrayIndexOutOfBoundsException
tapestry-json: code style
tapestrsy-json: fix lossy conversion
tapestry-json: source formatting
tapestry-json: throw IllegalArgumentException on invalid doubles
tapestry-json: JSONObject implements Map<String, Object>
To provide better interoperability with Java collections the JSONObject type now implements Map<String, Object>.
The needed changes are marginal:
tapestry-json: added get
{type}OrDefault methods to JSONObject
tapestry-json: make JSONArray a "real" Collection (wip)
tapestry-json: JSONArray improve javadoc
tapestry-json: JSONObject improve javadoc