Class JSONNumberImpl
java.lang.Object
org.tquadrat.foundation.jsonbuilder.internal.JSONNumberImpl
- All Implemented Interfaces:
Formattable, JSONNumber, JSONValue
@ClassVersion(sourceVersion="$Id: JSONNumberImpl.java 1190 2026-04-08 13:27:20Z tquadrat $")
@API(status=INTERNAL,
since="0.25.0")
public final class JSONNumberImpl
extends Object
implements JSONNumber
The implementation of the interface
JSONNumber.
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: JSONNumberImpl.java 1190 2026-04-08 13:27:20Z tquadrat $
- Since:
- 0.25.0
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.jsonbuilder.internal.JSONNumberImpl"
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanfinal voidfinal BigDecimalReturns the value as anBigDecimal.final BigIntegerReturns the value as anBigInteger.final doubleReturns the value as andouble.final floatgetFloat()Returns the value as anfloat.final intgetInt()Returns the value as anint.final longgetLong()Returns the value as anlong.inthashCode()final StringtoString()private static final StringvalidateNumber(String value) Validates whether the given value is a valid numerical value.
-
Field Details
-
m_Value
-
-
Constructor Details
-
JSONNumberImpl
Creates a new instance ofJSONNumber.- Parameters:
value- The value.
-
-
Method Details
-
equals
-
formatTo
-
getBigDecimal
Returns the value as an
BigDecimal.- Specified by:
getBigDecimalin interfaceJSONNumber- Returns:
- The value.
- Throws:
NumberFormatException- The value cannot be parsed to a validBigDecimal.
-
getBigInteger
Returns the value as an
BigInteger.- Specified by:
getBigIntegerin interfaceJSONNumber- Returns:
- The value.
- Throws:
NumberFormatException- The value cannot be parsed to a validBigInteger.
-
getDouble
Returns the value as an
double.- Specified by:
getDoublein interfaceJSONNumber- Returns:
- The value.
- Throws:
NumberFormatException- The value cannot be parsed to a validdouble.
-
getFloat
Returns the value as an
float.- Specified by:
getFloatin interfaceJSONNumber- Returns:
- The value.
- Throws:
NumberFormatException- The value cannot be parsed to a validfloat.
-
getInt
Returns the value as an
int.- Specified by:
getIntin interfaceJSONNumber- Returns:
- The value.
- Throws:
NumberFormatException- The value cannot be parsed to a validint.
-
getLong
Returns the value as an
long.- Specified by:
getLongin interfaceJSONNumber- Returns:
- The value.
- Throws:
NumberFormatException- The value cannot be parsed to a validlong.
-
hashCode
-
validateNumber
Validates whether the given value is a valid numerical value.- Parameters:
value- The value.- Returns:
- The given value.
- Throws:
ValidationException- The given value is not a valid number.
-
toString
-
