aboutsummaryrefslogtreecommitdiffstats
path: root/gson/src/test/java/org/onap/policy/common/gson/MapDoubleAdapterFactoryTest.java
AgeCommit message (Collapse)AuthorFilesLines
2019-07-17Convert double to int when decoding via gsonJim Hahn1-32/+80
Refactored MapDoubleAdapterFactory, extracting DoubleConverter to be used by code needing to convert Double to Integer/Long after being decoded by GSON. Enhanced StandardCoder to automatically use the above converter if the desired class is a generic Object. Change-Id: I1d4e83910de41ceda383f257bfea706db2b8fbbe Issue-ID: POLICY-1919 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-11Don't map JSON values to DoubleJim Hahn1-0/+117
By default, gson treats all numbers as Double when placed into a generic Map. This is not backward compatible with existing policy APIs. Added a type adapter that walks Map objects and converts the Double values to Integer or Long, where possible. Made this the default behavior in the GsonMessageBodyHandler, the JacksonHandler, and the StandardCoder. Also fixed a couple of checkstyle errors in the gson project. Change-Id: I9ac0c77e6592d1c039646f0662c077b77a1e9aaf Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>