Class NumberUtils
java.lang.Object
com.api.jsonata4java.expressions.utils.NumberUtils
- All Implemented Interfaces:
Serializable
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final com.fasterxml.jackson.databind.node.ValueNodeconvertNumberToValueNode(String number) The convertNumberToValueNode method converts the string passed in to a suitable subclass of ValueNode depending on whether it is an integer or decimal.static com.fasterxml.jackson.databind.node.ValueNodeconvertToNumber(String number) Attempts to convert a String based number representation using prefixes like 0x (hex), 0o (octal), 0b (binary)
-
Constructor Details
-
NumberUtils
public NumberUtils()
-
-
Method Details
-
convertNumberToValueNode
public static final com.fasterxml.jackson.databind.node.ValueNode convertNumberToValueNode(String number) The convertNumberToValueNode method converts the string passed in to a suitable subclass of ValueNode depending on whether it is an integer or decimal. For consistency with the JavaScript implementation of JSONata, we limit the size of the numbers that we handle to be within the range Double.MAX_VALUE and -Double.MAX_VALUE. If we did not do this we would need to implement a lot of extra code to handle BigInteger and BigDecimal.- Parameters:
number- The string representation of the number to convert- Returns:
- ValueNode The ValueNode representation of the number contained in the input string
- Throws:
EvaluateRuntimeException- If the number represented by the string is outside of the valid range or if the string does not contain a valid number.
-
convertToNumber
Attempts to convert a String based number representation using prefixes like 0x (hex), 0o (octal), 0b (binary)- Parameters:
number-- Returns:
-