This repository has been archived by the owner on Nov 28, 2017. It is now read-only.
This repository has been archived by the owner on Nov 28, 2017. It is now read-only.
reboot - using BigDecimal converters #3
Open
Description
We currently have BigDecimal
converters in the reboot version of json4s-ast
. There is an argument that this should be separate from the json4s-ast
, however there are also strong arguments for why it should be included, which are
- Verifies correctness of the construction of the
BigDecimal
insideJNumber
. As an example, a common rookie mistake is to do something likeJNumber(BigDecimal(3434f))
, where as, what you should do is something likeJNumber(BigDecimal.decimal(3434f))
. That method doesn't even exist inScala 2.10
, hence why the reason behind https://github.com/mdedetrich/json4s-ast/blob/reboot/jvm/src/main/scala/org/json4s/JValue.scala#L20 - Mandate a standard format for
JNumber
, which can help in serialization/portability between different libraries that usejson4s-ast
. Although not currently implemented, having a converter for something likeBigDecimal
toArray[Byte]
does make some sense in establishing a format - Provide convenience methods for really common use cases, i.e. going from
BigDecimal
toInt
when used for things like ids - Can provide performance improvements due to our aggressive use of
@inline
(see reboot - use of @inline #2)
Metadata
Assignees
Labels
No labels