Skip to content
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
@mdedetrich

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

  1. Verifies correctness of the construction of the BigDecimal inside JNumber. As an example, a common rookie mistake is to do something like JNumber(BigDecimal(3434f)), where as, what you should do is something like JNumber(BigDecimal.decimal(3434f)). That method doesn't even exist in Scala 2.10, hence why the reason behind https://github.com/mdedetrich/json4s-ast/blob/reboot/jvm/src/main/scala/org/json4s/JValue.scala#L20
  2. Mandate a standard format for JNumber, which can help in serialization/portability between different libraries that use json4s-ast. Although not currently implemented, having a converter for something like BigDecimal to Array[Byte] does make some sense in establishing a format
  3. Provide convenience methods for really common use cases, i.e. going from BigDecimal to Int when used for things like ids
  4. Can provide performance improvements due to our aggressive use of @inline (see reboot - use of @inline #2)

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions