public abstract class NumericParser
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.util.Map<java.lang.Class<? extends java.lang.Number>,NumericParser> |
PARSER_CLASS_MAP
map of parsers keyed by numeric class
|
Constructor and Description |
---|
NumericParser() |
Modifier and Type | Method and Description |
---|---|
abstract java.lang.Number |
getNumericValue(java.lang.String stringValue)
Parse the string value as a number
|
static java.lang.Number |
getNumericValue(java.lang.String stringValue,
java.lang.Class<? extends java.lang.Number> numericType)
Parse the string value as a number of the specified numeric type.
|
protected static java.util.Map<java.lang.Class<? extends java.lang.Number>,NumericParser> PARSER_CLASS_MAP
public static java.lang.Number getNumericValue(java.lang.String stringValue, java.lang.Class<? extends java.lang.Number> numericType) throws java.lang.NumberFormatException, java.lang.IllegalArgumentException
stringValue
- String representation of a numbernumericType
- The type of number to instantiatejava.lang.NumberFormatException
- if the string cannot be parsed into a numberjava.lang.IllegalArgumentException
- if the numeric type specified is unsupportedpublic abstract java.lang.Number getNumericValue(java.lang.String stringValue) throws java.lang.NumberFormatException
stringValue
- String representation of a numberjava.lang.NumberFormatException
- if the string cannot be parsed into a number