Class NumberParser

java.lang.Object
org.apache.commons.jexl3.parser.NumberParser
All Implemented Interfaces:
Serializable

public final class NumberParser extends Object implements Serializable
Parses number literals.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • BIGDF

      static final DecimalFormat BIGDF
      JEXL locale-neutral big decimal format.
    • literal

      private Number literal
      The type literal value.
    • clazz

      private Class<? extends Number> clazz
      The expected class.
  • Constructor Details

    • NumberParser

      public NumberParser()
    • NumberParser

      public NumberParser(Number number)
  • Method Details

    • maxBigIntegerDigits

      private static int maxBigIntegerDigits(int base)
      Returns the maximum digit count allowed for a BigInteger literal in the given base. When a JEXL engine with a bounded MathContext is active on the current thread, the engine's precision is converted to an equivalent bit limit, then to max digits for the base. Otherwise MAX_BIGINTEGER_DIGITS applies. At runtime, JexlArithmetic.checkBigIntegerPrecision() enforces the bit-length limit (f014, f013).
    • isNegative

      private static boolean isNegative(Token token)
    • parseDouble

      static Number parseDouble(Token negative, Token s)
    • parseInteger

      static Number parseInteger(Token negative, Token s)
    • assignNatural

      NumberParser assignNatural(boolean negative, String natural)
      Sets this node as a natural literal. Originally from OGNL.
      Parameters:
      negative - whether the natural should be negative
      natural - The natural as string
      Returns:
      this parser instance
    • assignNatural

      NumberParser assignNatural(String str)
      Sets this node as an (optionally) signed natural literal. Originally from OGNL.
      Parameters:
      str - The natural as string
      Returns:
      this parser instance
    • assignReal

      NumberParser assignReal(boolean negative, String s)
      Sets this node as a real literal. Originally from OGNL.
      Parameters:
      negative - whether the real should be negative
      s - The real as string
      Returns:
      this parser instance
    • assignReal

      NumberParser assignReal(String str)
      Sets this node as an (optionally) signed real literal. Originally from OGNL.
      Parameters:
      str - The real as string
      Returns:
      this parser instance
    • getLiteralClass

      Class<? extends Number> getLiteralClass()
    • getLiteralValue

      Number getLiteralValue()
    • isInteger

      boolean isInteger()
    • toString

      public String toString()
      Overrides:
      toString in class Object