Package jsonvalues

Class JsLong

    • Field Detail

      • value

        public final long value
        The long primitive.
    • Method Detail

      • id

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

        public boolean equals​(@Nullable Object that)
        Indicates whether some other object is "equal to" this json long. Numbers of different types are equals if the 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
      • hashCode

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

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

        public JsLong plus​(JsLong that)
        adds up this long to the specified one
        Parameters:
        that - the specified long
        Returns:
        the sum of both longs
      • minus

        public JsLong minus​(JsLong that)
        subtract this long from the specified one
        Parameters:
        that - the specified long
        Returns:
        this long minus the specified one
      • times

        public JsLong times​(JsLong that)
        multiplies this long by the specified one
        Parameters:
        that - the specified long
        Returns:
        this long times the specified one
      • 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
      • 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
      • intValueExact

        public OptionalInt intValueExact()
        Returns the value of this long; or an empty optional if the value overflows an int.
        Returns:
        this long as an int wrapped in an OptionalInt
      • equals

        public boolean equals​(JsBigDec jsBigDec)
        returns true if this long and the specified bigdecimal represent the same number
        Parameters:
        jsBigDec - the specified JsBigDec
        Returns:
        true if both JsElem are the same value
      • equals

        public boolean equals​(JsBigInt jsBigInt)
        returns true if this long and the specified biginteger represent the same number
        Parameters:
        jsBigInt - the specified JsBigInt
        Returns:
        true if both JsElem are the same value
      • equals

        public boolean equals​(JsInt jsInt)
        returns true if this long and the specified integer represent the same number
        Parameters:
        jsInt - the specified JsInt
        Returns:
        true if both JsElem are the same value
      • equals

        public boolean equals​(JsDouble jsDouble)
        returns true if this long and the specified double represent the same number
        Parameters:
        jsDouble - the specified JsDouble
        Returns:
        true if both JsElem are the same value
      • isLong

        public boolean isLong()
        Specified by:
        isLong in interface JsValue
        Returns:
        true if this JsElem is a JsLong
      • isNumber

        public boolean isNumber()
        Specified by:
        isNumber in interface JsValue
        Returns:
        true if this element is a number