Package jsonvalues
Class JsDouble
- java.lang.Object
-
- jsonvalues.JsPrimitive
-
- 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(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()
Returns true if this JsValue is a JsDoubleJsDouble
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 jsonvalues.JsNumber
isNumber, toJsPrimitive
-
Methods inherited from class jsonvalues.JsPrimitive
isJson, isPrimitive
-
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, isFalse, isInstant, isInstant, isInt, 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 Detail
-
TYPE_ID
public static final int TYPE_ID
- See Also:
- Constant Field Values
-
prism
public static final fun.optic.Prism<JsValue,Double> prism
prism between the sum type JsValue and JsDouble
-
value
public final double value
The double value.
-
-
Method Detail
-
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
-
isDouble
public boolean isDouble()
Description copied from interface:JsValue
Returns true if this JsValue is a JsDouble
-
compareTo
public int compareTo(JsDouble o)
Compares twoJsDouble
objects numerically.- Specified by:
compareTo
in interfaceComparable<JsDouble>
- See Also:
Double.compareTo(Double)
-
hashCode
public int hashCode()
Returns the hashcode of this json double.
-
equals
public boolean equals(Object that)
Indicates whether some other object is "equal to" this json double. Numbers of different types are equals if they have the same value.
-
toString
public String toString()
- Overrides:
toString
in classObject
- Returns:
- a string representation of this object.
- See Also:
Double.toString
-
map
public JsDouble map(DoubleUnaryOperator fn)
Maps this json double into another one.- Parameters:
fn
- the mapping function- 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
-
-