Package jsonvalues
Class JsLong
- java.lang.Object
-
- jsonvalues.JsNumber
-
- jsonvalues.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 Summary
Fields Modifier and Type Field Description longvalueThe long primitive.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(JsLong o)Compares twoJsLongobjects numerically.booleanequals(@Nullable Object that)Indicates whether some other object is "equal to" this json long.inthashCode()Returns the hashcode of this json long.intid()booleanisLong()JsLongmap(LongUnaryOperator fn)Maps this json long into another one.static JsLongof(long n)Static factory method to create a JsLong from a long primitive type.booleantest(LongPredicate predicate)Tests the value of this json long on a predicate.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jsonvalues.JsValue
isArray, isArray, isBigDec, isBigDec, isBigInt, isBigInt, isBool, isDecimal, isDouble, isDouble, isFalse, isInstant, isInstant, isInt, isInt, isIntegral, isJson, isJson, isLocalDate, isLocalDate, isLocalDateTime, isLocalDateTime, isLong, isNothing, isNotJson, isNotNothing, isNotNull, isNotNumber, isNull, isObj, isObj, isSameType, isStr, isStr, isTrue, toJsArray, toJsBigDec, toJsBigInt, toJsBool, toJsDouble, toJsInt, toJsLong, toJsNumber, toJsObj, toJson, toJsStr
-
-
-
-
Method Detail
-
compareTo
public int compareTo(JsLong o)
Compares twoJsLongobjects numerically.- Specified by:
compareToin interfaceComparable<JsLong>- See Also:
Long.compareTo(Long)
-
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.
-
hashCode
public int hashCode()
Returns the hashcode of this json long.
-
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
-
toString
public String toString()
- Overrides:
toStringin classObject- Returns:
- a string representation of the long value.
- See Also:
Long.toString
-
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
-
-