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 int
compareTo(JsDouble o)
Compares twoJsDouble
objects numerically.boolean
equals(@Nullable Object that)
Indicates whether some other object is "equal to" this json double.int
hashCode()
Returns the hashcode of this json double.int
id()
boolean
isDouble()
JsDouble
map(DoubleUnaryOperator fn)
Maps this json double into another one.static JsDouble
of(double n)
Static factory method to create a JsDouble from a double primitive type.boolean
test(DoublePredicate predicate)
Tests the value of this json double on a predicate.String
toString()
-
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 twoJsDouble
objects numerically.- Specified by:
compareTo
in 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:
toString
in classObject
- Returns:
- a string representation of this object.
- See Also:
Double.toString
-
-