Tuesday 15 September 2015

java - Using Realm.io to store money values -



java - Using Realm.io to store money values -

i'm starting play realm.io in android app i'm writing. in 1 of info objects i'm required store currency value. had stored value internally bigdecimal value , converted , double value when moving in , out of database.

i have been told bad thought store currency values in double because of way handled. unfortunately realm.io doesn't back upwards storage , retrieval of bigdecimal objects.

is best solution write own currency class extends realmobject , maintain fellow member variable of info object?

emanuele realm here.

you right, using floats or doubles currency bad idea.

we don't back upwards bigdecimal now, , before we have see how plays in relation other language bindings since want realm files compatible across supported platforms.

christian's thought good, see conversion , string bit slow. if don't need arbitrary precision property of bigdecimal utilize long , multiply/divide factor required precision calls for. save lot of space in terms of size of realm file since integer values bit packed.

java android realm

No comments:

Post a Comment