java.lang.Object
jsonvalues.JsPrimitive
jsonvalues.JsNumber
jsonvalues.JsInt
- All Implemented Interfaces:
Comparable<JsInt>,JsValue
Represents an immutable JSON number of type integer.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintCompares twoJsIntobjects numerically.booleanIndicates whether some other object is "equal to" this JSON integer.inthashCode()Returns the hashcode of this JSON integer.booleanisInt()Returns true if this JsValue is a 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.toString()Methods inherited from class jsonvalues.JsNumber
isNumber, toJsPrimitiveMethods inherited from class jsonvalues.JsPrimitive
isJson, isPrimitiveMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface jsonvalues.JsValue
ifNothing, ifNull, isArray, isArray, isBigDec, isBigDec, isBigInt, isBigInt, isBinary, isBool, isDecimal, isDouble, isDouble, isFalse, isInstant, isInstant, isInt, isIntegral, isJson, isLong, isLong, isNothing, isNotNothing, isNotNull, isNotNumber, isNull, isObj, isObj, isSameType, isStr, isStr, isTrue, toJsArray, toJsBigDec, toJsBigInt, toJsBinary, toJsBool, toJsDouble, toJsInstant, toJsInt, toJsLong, toJsNumber, toJsObj, toJson, toJsStr
-
Field Details
-
prism
prism between the sum type JsValue and JsInt -
value
public final int valueThe integer value.
-
-
Method Details
-
of
Static factory method to create a JsInt from an integer primitive type.- Parameters:
n- the integer primitive type- Returns:
- a new JsInt
-
isInt
public boolean isInt()Description copied from interface:JsValueReturns true if this JsValue is a JsInt -
compareTo
Compares twoJsIntobjects numerically.- Specified by:
compareToin interfaceComparable<JsInt>- See Also:
-
hashCode
public int hashCode()Returns the hashcode of this JSON integer. -
equals
Indicates whether some other object is "equal to" this JSON integer. Numbers of different types are equals if they have the same value. -
toString
-
map
Maps this JSON integer into another one.- Parameters:
fn- the mapping function- Returns:
- a new JsInt
-
test
/** Tests the value of this JSON integer on a predicate.- Parameters:
predicate- the predicate- Returns:
- true if this integer satisfies the predicate
-