Package jsonvalues
Class JsInt
- java.lang.Object
-
- jsonvalues.JsNumber
-
- jsonvalues.JsInt
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(JsInt o)Compares twoJsIntobjects numerically.booleanequals(java.lang.Object that)Indicates whether some other object is "equal to" this json integer.inthashCode()Returns the hashcode of this json integer.intid()booleanisInt()JsIntmap(java.util.function.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(java.util.function.IntPredicate predicate)/** Tests the value of this json integer on a predicate.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jsonvalues.JsValue
ifNothing, ifNull, isArray, isArray, isBigDec, isBigDec, isBigInt, isBigInt, isBinary, isBool, isDecimal, isDouble, isDouble, isFalse, isInstant, isInstant, isInt, isIntegral, isJson, isJson, isLong, isLong, isNothing, isNotJson, isNotNothing, isNotNull, isNotNumber, isNull, isObj, isObj, isSameType, isStr, isStr, isTrue, toJsArray, toJsBigDec, toJsBigInt, toJsBinary, toJsBool, toJsDouble, toJsInstant, toJsInt, toJsLong, toJsNumber, toJsObj, toJson, toJsStr
-
-
-
-
Field Detail
-
prism
public static final Prism<JsValue,java.lang.Integer> prism
prism between the sum type JsValue and JsInt
-
ID
public static final int ID
- See Also:
- Constant Field Values
-
value
public final int value
The integer value.
-
-
Method Detail
-
isInt
public boolean isInt()
-
compareTo
public int compareTo(JsInt o)
Compares twoJsIntobjects numerically.- Specified by:
compareToin interfacejava.lang.Comparable<JsInt>- See Also:
Integer.compareTo(Integer)
-
hashCode
public int hashCode()
Returns the hashcode of this json integer.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashcode of this JsInt
-
equals
public boolean equals(java.lang.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.- Overrides:
equalsin classjava.lang.Object- Parameters:
that- the reference object with which to compare.- Returns:
- true if that is a JsNumber with the same value as this JsInt.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of the integer value.
- See Also:
Integer.toString
-
map
public JsInt map(java.util.function.IntUnaryOperator fn)
Maps this json integer into another one.- Parameters:
fn- the mapping function- Returns:
- a new JsInt
-
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
-
test
public boolean test(java.util.function.IntPredicate predicate)
/** Tests the value of this json integer on a predicate.- Parameters:
predicate- the predicate- Returns:
- true if this integer satisfies the predicate
-
-