Package io.kjson
Class JSONDecimal
-
- All Implemented Interfaces:
-
io.kjson.JSONPrimitive,io.kjson.JSONValue,java.io.Serializable
public final class JSONDecimal extends JSONNumber implements JSONPrimitive<BigDecimal>
A JSON decimal value - that is, a JSON number that is not an integer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classJSONDecimal.Companion
-
Field Summary
Fields Modifier and Type Field Description private final BigDecimalasDecimalprivate final BigDecimalasDecimalOrNullprivate final BigDecimalvaluepublic final static JSONDecimal.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description JSONDecimal(String str)JSONDecimal(Long long)JSONDecimal(Integer int)JSONDecimal(BigDecimal value)
-
Method Summary
Modifier and Type Method Description final BigDecimalgetAsDecimal()final BigDecimalgetAsDecimalOrNull()BigDecimalgetValue()The value (will be overridden by a value of a specific type). StringtoJSON()Convert to a JSON string. UnitappendTo(Appendable a)Append as a JSON string to an Appendable. BooleanisIntegral()Return trueif the value is integral (has no fractional part, or the fractional part is zero).BooleanisLong()Return trueif the value is will fit in aLong.BooleanisInt()Return trueif the value is will fit in anInt.BooleanisShort()Return trueif the value is will fit in aShort.BooleanisByte()Return trueif the value is will fit in aByte.BooleanisULong()Return trueif the value is will fit in aULong.BooleanisUInt()Return trueif the value is will fit in aUInt.BooleanisUShort()Return trueif the value is will fit in aUShort.BooleanisUByte()Return trueif the value is will fit in aUByte.BooleanisZero()Return trueif the value is zero.BooleanisNegative()Return trueif the value is negative.BooleanisPositive()Return trueif the value is positive.BooleanisNotZero()Return trueif the value is not zero.BooleanisNotNegative()Return trueif the value is not negative.BooleanisNotPositive()Return trueif the value is not positive.DoubletoDouble()Convert the value to Double. FloattoFloat()Convert the value to Float. LongtoLong()Convert the value to Long. IntegertoInt()Convert the value to Int. CharactertoChar()Convert the value to Char. ShorttoShort()Convert the value to Short. BytetoByte()Convert the value to Byte. BigDecimaltoDecimal()Convert the value to BigDecimal. ULongtoULong()Convert the value to ULong. UInttoUInt()Convert the value to UInt. UShorttoUShort()Convert the value to UShort. UBytetoUByte()Convert the value to UByte. Booleanequals(Object other)Compare the value to another JSONNumber value. IntegerhashCode()Get the hash code for the JSONNumber value. StringtoString()Convert the value to String. -
-
Constructor Detail
-
JSONDecimal
JSONDecimal(String str)
-
JSONDecimal
JSONDecimal(Long long)
-
JSONDecimal
JSONDecimal(Integer int)
-
JSONDecimal
JSONDecimal(BigDecimal value)
-
-
Method Detail
-
getAsDecimal
final BigDecimal getAsDecimal()
-
getAsDecimalOrNull
final BigDecimal getAsDecimalOrNull()
-
getValue
BigDecimal getValue()
The value (will be overridden by a value of a specific type).
-
appendTo
Unit appendTo(Appendable a)
Append as a JSON string to an Appendable.
-
isIntegral
Boolean isIntegral()
Return
trueif the value is integral (has no fractional part, or the fractional part is zero).
-
isNegative
Boolean isNegative()
Return
trueif the value is negative.
-
isPositive
Boolean isPositive()
Return
trueif the value is positive.
-
isNotNegative
Boolean isNotNegative()
Return
trueif the value is not negative.
-
isNotPositive
Boolean isNotPositive()
Return
trueif the value is not positive.
-
toDecimal
BigDecimal toDecimal()
Convert the value to BigDecimal.
-
equals
Boolean equals(Object other)
Compare the value to another JSONNumber value. JSONNumber objects with different types but the same value are considered equal.
-
hashCode
Integer hashCode()
Get the hash code for the JSONNumber value. JSONNumber objects with different types but the same value will return the same hash code.
-
-
-
-