Class

argonaut

JsonDecimal

Related Doc: package argonaut

Permalink

case class JsonDecimal extends JsonNumber with Product with Serializable

A JsonDecimal represents and valid JSON number as a String. Unfortunately, there is no type in the Scala standard library which can represent all valid JSON decimal numbers, since the exponent may be larger than an Int. Such a number can still be round tripped (parser to printer). We lazily parse the string to a BigDecimal or a Double on demand.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. JsonDecimal
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. JsonNumber
  7. AnyRef
  8. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def asJson: Json

    Permalink
    Definition Classes
    JsonNumber
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(that: Any): Boolean

    Permalink
    Definition Classes
    JsonNumber → AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. def hashCode(): Int

    Permalink
    Definition Classes
    JsonNumber → AnyRef → Any
  12. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. def normalized: (BigInt, BigDecimal)

    Permalink

    Returns a *normalized* version of this Decimal number.

    Returns a *normalized* version of this Decimal number. Since BigDecimal cannot represent all valid JSON value exactly, due to the exponent being limited to an Int, this method let's us get a normalized number that can be used to compare for equality.

    The 1st value (BigInt) is the exponent used to scale the 2nd value (BigDecimal) back to the original value represented by this number. The 2nd BigDecimal will always either be 0 or a number with exactly 1 decimal digit to the right of the decimal point. If the 2nd value is 0, then the exponent will always be 0 as well.

  15. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  16. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  18. lazy val toBigDecimal: BigDecimal

    Permalink

    Returns this number as a BigDecimal.

    Returns this number as a BigDecimal.

    Definition Classes
    JsonDecimalJsonNumber
  19. def toBigInt: Option[BigInt]

    Permalink

    Returns this number as a BigInt, only if this number is an integer.

    Returns this number as a BigInt, only if this number is an integer.

    Definition Classes
    JsonNumber
  20. def toByte: Option[Byte]

    Permalink

    Returns this number as a Byte, only if this number is a valid Byte.

    Returns this number as a Byte, only if this number is a valid Byte.

    Definition Classes
    JsonNumber
  21. lazy val toDouble: Option[Double]

    Permalink

    Returns this number as a Double, only if this number can be represented as a Double.

    Returns this number as a Double, only if this number can be represented as a Double.

    Definition Classes
    JsonNumber
  22. lazy val toFloat: Option[Float]

    Permalink

    Returns this number as a Float, only if this number can be represented as a Float.

    Returns this number as a Float, only if this number can be represented as a Float.

    Definition Classes
    JsonNumber
  23. def toInt: Option[Int]

    Permalink

    Returns this number as a Int, only if this number is a valid Int.

    Returns this number as a Int, only if this number is a valid Int.

    Definition Classes
    JsonNumber
  24. def toLong: Option[Long]

    Permalink

    Returns this number as a Long, only if this number is a valid Long.

    Returns this number as a Long, only if this number is a valid Long.

    Definition Classes
    JsonDecimalJsonNumber
  25. def toShort: Option[Short]

    Permalink

    Returns this number as a Short, only if this number is a valid Short.

    Returns this number as a Short, only if this number is a valid Short.

    Definition Classes
    JsonNumber
  26. def truncateToBigInt: BigInt

    Permalink

    Truncates the number to a BigInt.

    Truncates the number to a BigInt. Truncation means that we round the real number towards 0 to the closest BigInt.

    Definition Classes
    JsonNumber
  27. def truncateToByte: Byte

    Permalink

    Truncates the number to a Byte.

    Truncates the number to a Byte. Truncation means that we round the real number towards 0 to the closest, valid Byte. So, if the number is 1e99, then this will return Byte.MaxValue.

    Definition Classes
    JsonNumber
  28. def truncateToDouble: Double

    Permalink

    Truncates this number to the best Double approximation to this number.

    Truncates this number to the best Double approximation to this number. Anything over Double.MaxValue gets rounded to Double.PositiveInfinity and anything below Double.MinValue gets rounded to Double.NegativeInfinity.

    Definition Classes
    JsonNumber
  29. def truncateToFloat: Float

    Permalink

    Truncates this number to the best Float approximation to this number.

    Truncates this number to the best Float approximation to this number. Anything over Float.MaxValue gets rounded to Float.PositiveInfinity and anything below Float.MinValue gets rounded to Float.NegativeInfinity.

    Definition Classes
    JsonNumber
  30. def truncateToInt: Int

    Permalink

    Truncates the number to a Int.

    Truncates the number to a Int. Truncation means that we round the real number towards 0 to the closest, valid Int. So, if the number is 1e99, then this will return Int.MaxValue.

    Definition Classes
    JsonNumber
  31. def truncateToLong: Long

    Permalink

    Truncates the number to a Long.

    Truncates the number to a Long. Truncation means that we round the real number towards 0 to the closest, valid Long. So, if the number is 1e99, then this will return Long.MaxValue.

    Definition Classes
    JsonNumber
  32. def truncateToShort: Short

    Permalink

    Truncates the number to a Short.

    Truncates the number to a Short. Truncation means that we round the real number towards 0 to the closest, valid Short. So, if the number is 1e99, then this will return Short.MaxValue.

    Definition Classes
    JsonNumber
  33. val value: String

    Permalink
  34. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from JsonNumber

Inherited from AnyRef

Inherited from Any

Ungrouped