Package jsonvalues

Class JsBigInt

All Implemented Interfaces:
Comparable<JsBigInt>, JsValue

public final class JsBigInt extends JsNumber implements Comparable<JsBigInt>
Represents an immutable JSON number of type BigInteger.
  • Field Details

    • prism

      public static final fun.optic.Prism<JsValue,BigInteger> prism
      prism between the sum type JsValue and JsBigInt. int and long types are considered valid bigintegers
    • value

      public final BigInteger value
      the big integer value.
  • Method Details

    • of

      public static JsBigInt of(BigInteger n)
      Static factory method to create a JsBigInt from BigInteger objects.
      Parameters:
      n - the big integer
      Returns:
      a new JsBigInt
    • 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 Comparable<JsBigInt>
      See Also:
    • hashCode

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

      public boolean equals(Object that)
      Indicates whether some other object is "equal to" this JSON big integer. Numbers of different types are equals if they have the same value.
      Overrides:
      equals in class 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 String toString()
      Overrides:
      toString in class Object
      Returns:
      a string representation of the bigint value.
      See Also:
    • map

      public JsBigInt map(UnaryOperator<BigInteger> fn)
      Maps this JSON bigint into another one.
      Parameters:
      fn - the mapping function
      Returns:
      a new JsBigInt
    • test

      public boolean test(Predicate<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