org.codehaus.groovy.syntax

## Class Numbers

- java.lang.Object
- - org.codehaus.groovy.syntax.Numbers

-     public class Numbers
      extends Object

  Helper class for processing Groovy numeric literals.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Numbers()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `isDigit(char c)` Returns true if the specified character is a base-10 digit.
    `static boolean` | `isHexDigit(char c)` Returns true if the specified character is a base-16 digit.
    `static boolean` | `isNumericTypeSpecifier(char c, boolean isDecimal)` Returns true if the specified character is a valid type specifier for a numeric value.
    `static boolean` | `isOctalDigit(char c)` Returns true if the specific character is a base-8 digit.
    `static Number` | `parseDecimal(String text)` Builds a Number from the given decimal descriptor.
    `static Number` | `parseInteger(AST reportNode, String text)` Builds a Number from the given integer descriptor.
    `static Number` | `parseInteger(String text)` Deprecated.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Numbers

          public Numbers()

  - ### Method Detail

    - #### isDigit

          public static boolean isDigit(char c)

      Returns true if the specified character is a base-10 digit.

    - #### isOctalDigit

          public static boolean isOctalDigit(char c)

      Returns true if the specific character is a base-8 digit.

    - #### isHexDigit

          public static boolean isHexDigit(char c)

      Returns true if the specified character is a base-16 digit.

    - #### isNumericTypeSpecifier

          public static boolean isNumericTypeSpecifier(char c,
                                                       boolean isDecimal)

      Returns true if the specified character is a valid type specifier for a numeric value.

    - #### parseInteger

          @Deprecated
          public static Number parseInteger(String text)

      Deprecated.
      Builds a Number from the given integer descriptor. Creates the narrowest type possible, or a specific type, if specified.
      Parameters:
        `text` - literal text to parse
      Returns:
        instantiated Number object
      Throws:
        `NumberFormatException` - if the number does not fit within the type requested by the type specifier suffix (invalid numbers don't make it here)

    - #### parseInteger

          public static Number parseInteger(AST reportNode,
                                            String text)

      Builds a Number from the given integer descriptor. Creates the narrowest type possible, or a specific type, if specified.
      Parameters:
        `reportNode` - at node for error reporting in the parser
        `text` - literal text to parse
      Returns:
        instantiated Number object
      Throws:
        `NumberFormatException` - if the number does not fit within the type requested by the type specifier suffix (invalid numbers don't make it here)

    - #### parseDecimal

          public static Number parseDecimal(String text)

      Builds a Number from the given decimal descriptor. Uses BigDecimal, unless, Double or Float is requested.
      Parameters:
        `text` - literal text to parse
      Returns:
        instantiated Number object
      Throws:
        `NumberFormatException` - if the number does not fit within the type requested by the type specifier suffix (invalid numbers don't make it here)