Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JCBC-1012: Add support for BigInteger and BigDecimal
Motivation ---------- It has been reported several times (on the forums and through customer interactions) that BigDecimal and BigInteger support through the JsonObject and JsonArray types would be appreciated. Modifications ------------- This changeset enables this functionality and adds test cases. Both JsonObject and JsonArray now have more getters and setters for these types, but there is one gotcha. By default jackson will read the BigDecimal as a double, which is the type returned. For very long numbers there might be precision loss. To combat this, the system property com.couchbase.json.decimalForFloat has been introduced which, when set to true, will always read doubles as BigDecimal on the jackson side and therefore trade speed for accuracy. Separate tests have been added to assert this on a unit-test level. Result ------ It is now possible to use BigInteger and BigDecimal types the same way as one would do with other already supported types. Change-Id: I357a9533692d705510018228fcadeec760f811f5 Reviewed-on: http://review.couchbase.org/71435 Tested-by: Michael Nitschinger <michael@nitschinger.at> Reviewed-by: Subhashni Balakrishnan <b.subhashni@gmail.com> Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
- Loading branch information
Showing
8 changed files
with
328 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.