Package jsonvalues

Class JsBigInt

  • All Implemented Interfaces:
    java.lang.Comparable<JsBigInt>, JsValue

    public final class JsBigInt
    extends JsNumber
    implements java.lang.Comparable<JsBigInt>
    Represents an immutable json number of type BigInteger.
    • Field Detail

      • prism

        public static final Prism<JsValue,​java.math.BigInteger> prism
      • value

        public final java.math.BigInteger value
        the big integer value.
    • Method Detail

      • id

        public int id()
        Specified by:
        id in interface JsValue
      • isBigInt

        public boolean isBigInt()
        Description copied from interface: JsValue
        Returns true if this JsValue is a JsBigInt
        Specified by:
        isBigInt in interface JsValue
        Returns:
        true if this JsValue is a JsBigInt
      • compareTo

        public int compareTo​(JsBigInt o)
        Compares two JsBigInt objects numerically.
        Specified by:
        compareTo in interface java.lang.Comparable<JsBigInt>
        See Also:
        compareTo(JsBigInt)
      • hashCode

        public int hashCode()
        Returns the hashcode of this json big integer.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hashcode of this JsBigInt
      • equals

        public boolean equals​(java.lang.Object that)
        Indicates whether some other object is "equal to" this json big integer. Numbers of different types are equals if the have the same value.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        that - the reference object with which to compare.
        Returns:
        true if that is a JsNumber with the same value as this
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of the bigint value.
        See Also:
        BigInteger.toString
      • map

        public JsBigInt map​(java.util.function.UnaryOperator<java.math.BigInteger> fn)
        Maps this json bigint into another one.
        Parameters:
        fn - the mapping function
        Returns:
        a new JsBigInt
      • of

        public static JsBigInt of​(java.math.BigInteger n)
        Static factory method to create a JsBigInt from BigInteger objects.
        Parameters:
        n - the big integer
        Returns:
        a new JsBigInt
      • test

        public boolean test​(java.util.function.Predicate<java.math.BigInteger> predicate)
        Tests the value of this json bigint on a predicate.
        Parameters:
        predicate - the predicate
        Returns:
        true if this big integer satisfies the predicate