public class NumberParserImpl extends Object
| Constructor and Description |
|---|
NumberParserImpl(int parseFlags)
Creates a new, empty parser.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMatcher(NumberParseMatcher matcher) |
void |
addMatchers(Collection<? extends NumberParseMatcher> matchers) |
static NumberParserImpl |
createDefaultParserForLocale(ULocale loc) |
static NumberParserImpl |
createParserFromProperties(DecimalFormatProperties properties,
DecimalFormatSymbols symbols,
boolean parseCurrency)
Creates a parser from the given DecimalFormatProperties.
|
static NumberParserImpl |
createSimpleParser(ULocale locale,
String pattern,
int parseFlags)
Creates a parser with most default options.
|
void |
freeze() |
int |
getParseFlags() |
void |
parse(String input,
boolean greedy,
ParsedNumber result) |
void |
parse(String input,
int start,
boolean greedy,
ParsedNumber result)
Primary entrypoint to parsing code path.
|
static Number |
parseStatic(String input,
ParsePosition ppos,
DecimalFormatProperties properties,
DecimalFormatSymbols symbols)
Parses the string without returning a NumberParserImpl.
|
static CurrencyAmount |
parseStaticCurrency(String input,
ParsePosition ppos,
DecimalFormatProperties properties,
DecimalFormatSymbols symbols)
Parses the string without returning a NumberParserImpl.
|
String |
toString() |
public NumberParserImpl(int parseFlags)
parseFlags - The parser settings defined in the PARSE_FLAG_* fields.public static NumberParserImpl createSimpleParser(ULocale locale, String pattern, int parseFlags)
public static Number parseStatic(String input, ParsePosition ppos, DecimalFormatProperties properties, DecimalFormatSymbols symbols)
public static CurrencyAmount parseStaticCurrency(String input, ParsePosition ppos, DecimalFormatProperties properties, DecimalFormatSymbols symbols)
public static NumberParserImpl createDefaultParserForLocale(ULocale loc)
public static NumberParserImpl createParserFromProperties(DecimalFormatProperties properties, DecimalFormatSymbols symbols, boolean parseCurrency)
properties - The property bag.symbols - The locale's symbols.parseCurrency - True to force a currency match and use monetary separators; false otherwise.public void addMatcher(NumberParseMatcher matcher)
public void addMatchers(Collection<? extends NumberParseMatcher> matchers)
public void freeze()
public int getParseFlags()
public void parse(String input, boolean greedy, ParsedNumber result)
public void parse(String input, int start, boolean greedy, ParsedNumber result)
input - The string to parse. This is a String, not CharSequence, to enforce assumptions about
immutability (CharSequences are not guaranteed to be immutable).start - The index into the string at which to start parsing.greedy - Whether to use the faster but potentially less accurate greedy code path.result - Output variable to store results.