[jira] [Commented] (SLING-3368) Add toMap iterable to resp. JSONObject and JSONArray
[ https://issues.apache.org/jira/browse/SLING-3368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13890541#comment-13890541 ] Felix Meschberger commented on SLING-3368: -- I don't like the toMap method because it exposes the internal map which is generally protected by the accessor methods to make sure updates are reasonable. As for the addition to ArrayList: This also exposes internal storage, yet it is not as problematic because except for the Iterator's remove method, there is not much harm done. Still I am not convinced we should implement these deviations from the original JSON code we got from org.json (we currently basically only have one change which is the use of a LinkedHashMap instead of HashMap in the JSONObject) Add toMap iterable to resp. JSONObject and JSONArray -- Key: SLING-3368 URL: https://issues.apache.org/jira/browse/SLING-3368 Project: Sling Issue Type: Improvement Components: Commons Reporter: Nicolas Peltier Priority: Minor Attachments: [json]_add_other_ways_to_use_JSONArray_and_JSONObject.patch Map JSONObject.toMap and JSONArray implementing Iterable allows better usage of those classes. -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[jira] [Commented] (SLING-3368) Add toMap iterable to resp. JSONObject and JSONArray
[ https://issues.apache.org/jira/browse/SLING-3368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13890695#comment-13890695 ] Justin Edelson commented on SLING-3368: --- A simple solution would be to wrap the map/list object in Collections.unmodifyableXXX(). My guess is that the primary use case for these additions are for read-only access. FWIW, I think these additions are useful (at least for read access), especially in a scripting context as many scripting languages have native support for maps and iterators. I don't share [~fmeschbe] 's sense of fealty to the original org.json code :) Add toMap iterable to resp. JSONObject and JSONArray -- Key: SLING-3368 URL: https://issues.apache.org/jira/browse/SLING-3368 Project: Sling Issue Type: Improvement Components: Commons Reporter: Nicolas Peltier Priority: Minor Attachments: [json]_add_other_ways_to_use_JSONArray_and_JSONObject.patch Map JSONObject.toMap and JSONArray implementing Iterable allows better usage of those classes. -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[jira] [Commented] (SLING-3368) Add toMap iterable to resp. JSONObject and JSONArray
[ https://issues.apache.org/jira/browse/SLING-3368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13890717#comment-13890717 ] Nicolas Peltier commented on SLING-3368: Hi, note that toMap is not called getMap :-), it's meant to be a conversion method. Implementation is a getter then, i agree. I've contributed this because i've been a lot of time aching to manipulate JSONObject JSONArray in a simple way. I agree this gives opportunities to mess up an object, but the API doesn't guarantee that, it can be strenghtened later on (or now if you think it's still worth it). Add toMap iterable to resp. JSONObject and JSONArray -- Key: SLING-3368 URL: https://issues.apache.org/jira/browse/SLING-3368 Project: Sling Issue Type: Improvement Components: Commons Reporter: Nicolas Peltier Priority: Minor Attachments: [json]_add_other_ways_to_use_JSONArray_and_JSONObject.patch Map JSONObject.toMap and JSONArray implementing Iterable allows better usage of those classes. -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[jira] [Commented] (SLING-3368) Add toMap iterable to resp. JSONObject and JSONArray
[ https://issues.apache.org/jira/browse/SLING-3368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13889982#comment-13889982 ] Justin Edelson commented on SLING-3368: --- Is there any reason to be concerned that the returned maps/iterator are mutable? Add toMap iterable to resp. JSONObject and JSONArray -- Key: SLING-3368 URL: https://issues.apache.org/jira/browse/SLING-3368 Project: Sling Issue Type: Improvement Components: Commons Reporter: Nicolas Peltier Priority: Minor Attachments: [json]_add_other_ways_to_use_JSONArray_and_JSONObject.patch Map JSONObject.toMap and JSONArray implementing Iterable allows better usage of those classes. -- This message was sent by Atlassian JIRA (v6.1.5#6160)