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
Reviewed-on: http://review.couchbase.org/43440
Tested-by: Estrella Humphrey xxx@xxx.xxx
Reviewed-by: Natasha Sullivan xxx@xxx.xxx


COMMENTS

author: Estrella Humphrey
date: 2014-11-21 10:25:31.669000000

Change has been successfully cherry-picked as f98980929e4f745af9c160eb3915b06f1b81aad9

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