You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by satyen <sa...@gmail.com> on 2019/10/24 00:47:55 UTC

USE_BIG_DECIMAL_FOR_FLOATS feature in Olingo Client

Hello,

I would like to take advantage of USE_BIG_DECIMAL_FOR_FLOATS feature in
Onlingo Client.

My olingo JSON response has big decimal value. By default Olingo Client
converts it to Exponential value String. But I would like to read the value
as big decimal String.

Example
OData query response has 2,000,000,000. ClientEntity's ClientPrimitiveValue
is 2E9. (2,000,000,000 → 2E9)
I would like to get ClientPrimitiveValue as 2000000000

I searched for solution and I found that I need to use
DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS and
JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN features for
Deserialization ObjectMapper.
I did not find any way to set these features to ObjectMapper that Olingo
client uses.

How would I enable the ObjectMapper feature USE_BIG_DECIMAL_FOR_FLOATS,
WRITE_BIGDECIMAL_AS_PLAIN?

Is there any way other than workaround as I did?


As workaround I have overridden following classes to utimately set
USE_BIG_DECIMAL_FOR_FLOATS, WRITE_BIGDECIMAL_AS_PLAIN
org.apache.olingo.client.core.ODataClientImpl,
org.apache.olingo.client.core.serialization.ClientODataDeserializerImpl,
org.apache.olingo.client.core.serialization.JsonDeserializer,
com.fasterxml.jackson.databind.ObjectMapper,
org.apache.olingo.client.core.serialization.JsonEntityDeserializer


Thanks in advance