Package org.codehaus.groovy.syntax
Class Numbers
java.lang.Object
org.codehaus.groovy.syntax.Numbers
Helper class for processing Groovy numeric literals.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic booleanisDigit(char c) Returns true if the specified character is a base-10 digit.static booleanisHexDigit(char c) Returns true if the specified character is a base-16 digit.static booleanisNumericTypeSpecifier(char c, boolean isDecimal) Returns true if the specified character is a valid type specifier for a numeric value.static booleanisOctalDigit(char c) Returns true if the specific character is a base-8 digit.static NumberparseDecimal(String text) Builds a Number from the given decimal descriptor.static NumberparseInteger(String text) Builds a Number from the given integer descriptor.
- 
Constructor Details- 
Numberspublic Numbers()
 
- 
- 
Method Details- 
isDigitpublic static boolean isDigit(char c) Returns true if the specified character is a base-10 digit.
- 
isOctalDigitpublic static boolean isOctalDigit(char c) Returns true if the specific character is a base-8 digit.
- 
isHexDigitpublic static boolean isHexDigit(char c) Returns true if the specified character is a base-16 digit.
- 
isNumericTypeSpecifierpublic static boolean isNumericTypeSpecifier(char c, boolean isDecimal) Returns true if the specified character is a valid type specifier for a numeric value.
- 
parseIntegerBuilds 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)
 
- 
parseDecimalBuilds 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)
 
 
-