argonaut

JsonNumber

sealed abstract class JsonNumber extends AnyRef

JSON numbers with optimization by cases. Note: Javascript numbers are 64-bit decimals.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. JsonNumber
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new JsonNumber()

Abstract Value Members

  1. abstract def toBigDecimal: BigDecimal

    Returns this number as a BigDecimal.

  2. abstract def toDouble: Double

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

    Converts 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.NegativeInfinitey.

  3. abstract def toLong: Option[Long]

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

  4. abstract def truncateToLong: Long

    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.

Concrete Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def asJson: Option[Json]

    Construct a JSON value that is a number.

    Construct a JSON value that is a number.

    Note: NaN, +Infinity and -Infinity are not valid json.

  8. def asJsonOrNull: Json

    Construct a JSON value that is a number.

    Construct a JSON value that is a number. Transforming NaN, +Infinity and -Infinity to jNull. This matches the behaviour of most browsers, but is a lossy operation as you can no longer distinguish between NaN and Infinity.

  9. def asJsonOrString: Json

    Construct a JSON value that is a number.

    Construct a JSON value that is a number. Transforming NaN, +Infinity and -Infinity to their string implementations.

    This is an argonaut specific transformation that allows all doubles to be encoded without losing information, but aware interoperability is unlikely without custom handling of these values. See also jNumber and jNumberOrNull.

  10. def clone(): AnyRef

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

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

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

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

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

    Definition Classes
    JsonNumber → AnyRef → Any
  16. def isInfinity: Boolean

    Returns true iff this number wraps a Double and it is PositiveInfinity or NegativeInfinitey.

  17. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  18. def isNaN: Boolean

    Returns true iff this number wraps a Double and it is NaN.

  19. def isReal: Boolean

    Returns true if this is a valid real number (ie.

    Returns true if this is a valid real number (ie. !(isNaN || isInfinity)).

  20. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  21. final def notify(): Unit

    Definition Classes
    AnyRef
  22. final def notifyAll(): Unit

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

    Definition Classes
    AnyRef
  24. def toBigInt: Option[BigInt]

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

  25. def toByte: Option[Byte]

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

  26. def toFloat: Float

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

    Converts 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.NegativeInfinitey.

  27. def toInt: Option[Int]

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

  28. def toShort: Option[Short]

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

  29. def toString(): String

    Definition Classes
    AnyRef → Any
  30. def truncateToBigInt: BigInt

    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.

  31. def truncateToByte: Byte

    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.

  32. def truncateToInt: Int

    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.

  33. def truncateToShort: Short

    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.

  34. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped