Package io.kjson

Class JSONNumber

  • All Implemented Interfaces:
    io.kjson.JSONValue , java.io.Serializable

    
    public class JSONNumber
    extends Number implements JSONValue
                        

    An abstract base class for the three number types of JSON value. It includes functions to assist with conversion between number types.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final Number value
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract Number getValue() The value (will be overridden by a value of a specific type).
      abstract Boolean isIntegral() Return true if the value is integral (has no fractional part, or the fractional part is zero).
      abstract Boolean isLong() Return true if the value will fit in a Long.
      abstract Boolean isInt() Return true if the value will fit in an Int.
      abstract Boolean isShort() Return true if the value will fit in a Short.
      abstract Boolean isByte() Return true if the value will fit in a Byte.
      abstract Boolean isULong() Return true if the value will fit in a ULong.
      abstract Boolean isUInt() Return true if the value will fit in a UInt.
      abstract Boolean isUShort() Return true if the value will fit in a UShort.
      abstract Boolean isUByte() Return true if the value will fit in a UByte.
      abstract Boolean isZero() Return true if the value is zero.
      abstract Boolean isNegative() Return true if the value is negative.
      abstract Boolean isPositive() Return true if the value is positive.
      abstract Boolean isNotZero() Return true if the value is not zero.
      abstract Boolean isNotNegative() Return true if the value is not negative.
      abstract Boolean isNotPositive() Return true if the value is not positive.
      abstract BigDecimal toDecimal() Convert the value to BigDecimal.
      abstract ULong toULong() Convert the value to ULong.
      abstract UInt toUInt() Convert the value to UInt.
      abstract UShort toUShort() Convert the value to UShort.
      abstract UByte toUByte() Convert the value to UByte.
      abstract Boolean equals(Object other) Compare the value to another JSONNumber value.
      abstract Integer hashCode() Get the hash code for the JSONNumber value.
      • Methods inherited from class kotlin.Number

        toByte, toChar, toDouble, toFloat, toInt, toLong, toShort
      • Methods inherited from class io.kjson.JSONValue

        appendTo, coOutput, coOutputTo, output, outputTo, toJSON
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait