Class NumberFormatParser
- java.lang.Object
-
- de.xima.fc.form.common.number_format.NumberFormatParser
-
public final class NumberFormatParser extends Object
Parses a formatted numeric string, according to the formatting rules from anNumberFormatOptionsinstance.- Since:
- 8.2.2
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NumberFormatParsernewParser(NumberFormatOptions options)Creates a new parser for parsing formatted numeric strings, according to the givenformatting rules.BigDecimalparse(String value)Parses a formatted numeric string according to the formatting rules of this instance.static BigDecimalparse(String value, NumberFormatOptions options)Parses a formatted numeric string, according to the formatting rules from anNumberFormatOptionsinstance.
-
-
-
Method Detail
-
parse
public BigDecimal parse(String value) throws NumberFormatParseException
Parses a formatted numeric string according to the formatting rules of this instance. When the value represents no number (empty string or just a unit), returns null.- Parameters:
value- The formatted numeric string.- Returns:
- The parsed numeric value.
- Throws:
NumberFormatParseException- If the value cannot be parsed.
-
newParser
public static NumberFormatParser newParser(NumberFormatOptions options)
Creates a new parser for parsing formatted numeric strings, according to the givenformatting rules.- Parameters:
options- The formatting rules.- Returns:
- A new parser for the given formatting rules.
-
parse
public static BigDecimal parse(String value, NumberFormatOptions options) throws NumberFormatParseException
Parses a formatted numeric string, according to the formatting rules from anNumberFormatOptionsinstance.- Parameters:
options- The formatting rules.value- The formatted numeric string.- Returns:
- The parsed numeric value.
- Throws:
NumberFormatParseException- If the value cannot be parsed.
-
-