Package jsonvalues
Class JsInt
- java.lang.Object
-
- jsonvalues.JsNumber
-
- jsonvalues.JsInt
-
- All Implemented Interfaces:
Comparable<JsInt>,JsValue
public final class JsInt extends JsNumber implements Comparable<JsInt>
Represents an immutable json number of type integer.
-
-
Field Summary
Fields Modifier and Type Field Description intvalueThe integer value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(JsInt o)Compares twoJsIntobjects numerically.booleanequals(@Nullable Object that)Indicates whether some other object is "equal to" this json integer.inthashCode()Returns the hashcode of this json integer.intid()booleanisInt()JsIntmap(IntUnaryOperator fn)Maps this json integer into another one.static JsIntof(int n)Static factory method to create a JsInt from an integer primitive type.booleantest(IntPredicate predicate)/** Tests the value of this json integer 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, isIntegral, isJson, isJson, isLocalDate, isLocalDate, isLocalDateTime, isLocalDateTime, isLong, 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(JsInt o)
Compares twoJsIntobjects numerically.- Specified by:
compareToin interfaceComparable<JsInt>- See Also:
Integer.compareTo(Integer)
-
equals
public boolean equals(@Nullable Object that)
Indicates whether some other object is "equal to" this json integer. Numbers of different types are equals if the have the same value.
-
hashCode
public int hashCode()
Returns the hashcode of this json integer.
-
toString
public String toString()
- Overrides:
toStringin classObject- Returns:
- a string representation of the integer value.
- See Also:
Integer.toString
-
of
public static JsInt of(int n)
Static factory method to create a JsInt from an integer primitive type.- Parameters:
n- the integer primitive type- Returns:
- a new JsInt
-
map
public JsInt map(IntUnaryOperator fn)
Maps this json integer into another one.- Parameters:
fn- the mapping function- Returns:
- a new JsInt
-
test
public boolean test(IntPredicate predicate)
/** Tests the value of this json integer on a predicate.- Parameters:
predicate- the predicate- Returns:
- true if this integer satisfies the predicate
-
-