Package jsonvalues

Class JsLong

All Implemented Interfaces:
Comparable<JsLong>, JsValue

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

    • prism

      public static final fun.optic.Prism<JsValue,Long> prism
      prism between the sum type JsValue and JsLong
    • value

      public final long value
      The long primitive.
  • Method Details

    • of

      public static JsLong of(long n)
      Static factory method to create a JsLong from a long primitive type.
      Parameters:
      n - the long primitive type
      Returns:
      a new JsLong
    • isLong

      public boolean isLong()
      Description copied from interface: JsValue
      Returns this JsValue as a JsLong.
      Specified by:
      isLong in interface JsValue
      Returns:
      This JsValue as a JsLong.
    • compareTo

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

      public int hashCode()
      Returns the hashcode of this JSON long.
      Overrides:
      hashCode in class Object
      Returns:
      hashcode of this JsLong
    • equals

      public boolean equals(Object that)
      Indicates whether some other object is "equal to" this JSON long. 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 JsLong
    • toString

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

      public JsLong map(LongUnaryOperator fn)
      Maps this JSON long into another one.
      Parameters:
      fn - the mapping function
      Returns:
      a new JsLong
    • test

      public boolean test(LongPredicate predicate)
      Tests the value of this JSON long on a predicate.
      Parameters:
      predicate - the predicate
      Returns:
      true if this long satisfies the predicate