Class NumberUtils

java.lang.Object
com.api.jsonata4java.expressions.utils.NumberUtils
All Implemented Interfaces:
Serializable

public class NumberUtils extends Object implements Serializable
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static final com.fasterxml.jackson.databind.node.ValueNode
    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.ValueNode
    Attempts to convert a String based number representation using prefixes like 0x (hex), 0o (octal), 0b (binary)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public static com.fasterxml.jackson.databind.node.ValueNode convertToNumber(String number)
      Attempts to convert a String based number representation using prefixes like 0x (hex), 0o (octal), 0b (binary)
      Parameters:
      number -
      Returns: