Package jsonvalues
Class JsDouble
- java.lang.Object
-
- jsonvalues.JsNumber
-
- jsonvalues.JsDouble
-
- All Implemented Interfaces:
Comparable<JsDouble>,JsValue
public final class JsDouble extends JsNumber implements Comparable<JsDouble>
Represents an immutable json number of type double.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(JsDouble o)Compares twoJsDoubleobjects numerically.booleanequals(@Nullable Object that)Indicates whether some other object is "equal to" this json double.inthashCode()Returns the hashcode of this json double.intid()booleanisDouble()JsDoublemap(DoubleUnaryOperator fn)Maps this json double into another one.static JsDoubleof(double n)Static factory method to create a JsDouble from a double primitive type.booleantest(DoublePredicate predicate)Tests the value of this json double 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, isFalse, isInstant, isInstant, isInt, 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
-
-
-
-
Field Detail
-
ID
public static final int ID
- See Also:
- Constant Field Values
-
value
public final double value
The double value.
-
-
Method Detail
-
compareTo
public int compareTo(JsDouble o)
Compares twoJsDoubleobjects numerically.- Specified by:
compareToin interfaceComparable<JsDouble>- See Also:
Double.compareTo(Double)
-
equals
public boolean equals(@Nullable Object that)
Indicates whether some other object is "equal to" this json double. Numbers of different types are equals if the have the same value.
-
hashCode
public int hashCode()
Returns the hashcode of this json double.
-
map
public JsDouble map(DoubleUnaryOperator fn)
Maps this json double into another one.- Parameters:
fn- the mapping function- Returns:
- a new JsDouble
-
of
public static JsDouble of(double n)
Static factory method to create a JsDouble from a double primitive type.- Parameters:
n- the double primitive type- Returns:
- a new JsDouble
-
test
public boolean test(DoublePredicate predicate)
Tests the value of this json double on a predicate.- Parameters:
predicate- the predicate- Returns:
- true if this double satisfies the predicate
-
toString
public String toString()
- Overrides:
toStringin classObject- Returns:
- a string representation of this object.
- See Also:
Double.toString
-
-