Package jsonvalues
Class JsBigDec
- java.lang.Object
-
- jsonvalues.JsPrimitive
-
- jsonvalues.JsNumber
-
- jsonvalues.JsBigDec
-
- All Implemented Interfaces:
Comparable<JsBigDec>
,JsValue
public final class JsBigDec extends JsNumber implements Comparable<JsBigDec>
Represents an immutable json number of type BigDecimal.
-
-
Field Summary
Fields Modifier and Type Field Description static fun.optic.Prism<JsValue,BigDecimal>
prism
prism between the sum type JsValue and JsBigDecstatic int
TYPE_ID
BigDecimal
value
The big decimal value
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(JsBigDec o)
Compares twoJsBigDec
objects numericallyboolean
equals(Object that)
Indicates whether some other object is "equal to" this json big decimal.int
hashCode()
Returns the hashcode of this json big decimalint
id()
boolean
isBigDec()
Returns true if this JsValue is a JsBigDecJsBigDec
map(UnaryOperator<BigDecimal> fn)
Maps this JsBigDec into another onestatic JsBigDec
of(BigDecimal n)
Static factory method to create a JsBigDec from a BigDecimal object.boolean
test(Predicate<BigDecimal> predicate)
Tests the value of this json big-decimal on a predicateString
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, isBigInt, isBigInt, isBinary, isBool, isDecimal, isDouble, 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,BigDecimal> prism
prism between the sum type JsValue and JsBigDec
-
value
public final BigDecimal value
The big decimal value
-
-
Method Detail
-
of
public static JsBigDec of(BigDecimal n)
Static factory method to create a JsBigDec from a BigDecimal object.- Parameters:
n
- the big decimal- Returns:
- a new JsBigDec
-
isBigDec
public boolean isBigDec()
Description copied from interface:JsValue
Returns true if this JsValue is a JsBigDec
-
compareTo
public int compareTo(JsBigDec o)
Compares twoJsBigDec
objects numerically- Specified by:
compareTo
in interfaceComparable<JsBigDec>
- See Also:
compareTo(JsBigDec)
-
hashCode
public int hashCode()
Returns the hashcode of this json big decimal
-
equals
public boolean equals(Object that)
Indicates whether some other object is "equal to" this json big decimal. 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 the big-decimal value
- See Also:
BigDecimal.toString
-
map
public JsBigDec map(UnaryOperator<BigDecimal> fn)
Maps this JsBigDec into another one- Parameters:
fn
- the mapping function- Returns:
- a new JsBigDec
-
test
public boolean test(Predicate<BigDecimal> predicate)
Tests the value of this json big-decimal on a predicate- Parameters:
predicate
- the predicate- Returns:
- true if this big decimal satisfies the predicate
-
-