DESCRIPTION

JCBC-624: improve JsonObject.getNUMBER methods

Motivation
----------
When stored and read back, a JsonObject long field for example can be
restored as an Integer (because it is small enough). This leads to a
ClassCastException when calling the getLong method.
Same is true for the three Number-related get methods : getLong, getInt
and getDouble.

Modifications
-------------
The methods getLong, getInt and getDouble now all expect just a Number
instance in the Json content. If the Number is of the asked type, or if
it is null, it is returned directly. Otherwise it is converted to the
asked type by calling e.g. Number.longValue() method and letting Java
autobox the value.

An integration test  was added (because this is only visible when
storing and transcoding the document), along with two new unit tests in
JsonObjectTest (for conversion and null management).

Result
------
Putting a number in a JsonDocument, storing it and getting it back in
any numerical form now works correctly. Nulls are returned correctly
when value is not present. No more ClassCastExceptions occur as long as
the value is numerical.
All tests pass.

Change-Id: Ia3ad4e7b7ee9f0b74499aeec0067c88ef9b5925a


COMMENTS

author: Estrella Humphrey
date: 2014-11-18 10:55:39.548000000

Uploaded patch set 1.

-------------------------------------
author: Estrella Humphrey
date: 2014-11-18 10:56:02.759000000

Patch Set 1: Verified+1

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