DESCRIPTION

JCBC-614: Add Json builders from Map and List

Motivation
----------
For quality of life of developper, it is interesting to have factory
methods that allow building JsonObject and JsonArray instances from
respectively a Map and a List.

These source collections should be checked for invalid content such as
null keys or values of unsupported type.

Modifications
-------------
Added factory method from(Map<String, ?>) on JsonObject.
Added factory method from(List<?>) on JsonArray.

Attempting to use such methods with an empty collection will
result in the creation of an empty JsonValue, whereas a null input
will throw a NullPointerException.

Sub-collections are authorized, with the same restrictions. Incorrect
sub-collections will cause a ClassCastException (which may have a
cause, depending on the error condition).

Null values are now authorized, especially by JsonValue.checkType.

Added unit tests to check behavior of factory methods, especially in
regard to invalid input (null keys in map, values of an
unsupported type).

Result
------
Users can now build JsonObjects from a Map and JsonArrays from a List.
All new tests pass.

Change-Id: Ie07b66166c91d5440f6f821fefd9493f16c2180e


COMMENTS

author: Estrella Humphrey
date: 2014-11-20 17:05:54.595000000

Uploaded patch set 2.

-------------------------------------
author: Estrella Humphrey
date: 2014-11-20 17:12:09.957000000

Patch Set 2: Verified+1

reworked to allow sub-collections recursively.

the &gt syntax in javadoc is needed as far as I can see (otherwise it's just ignored, as a tag).

the ListIterator is more efficient than a for(int) loop (since some implementations of List out there have inefficient get, for instance LinkedList), and is equivalent to a foreach loop with the added benefit of exposing the index ;)

-------------------------------------
author: Natasha Sullivan
date: 2014-11-21 10:22:24.897000000

Patch Set 2: Code-Review+2

-------------------------------------
