Class BigDecimalStringParser
java.lang.Object
com.martiansoftware.jsap.StringParser
com.martiansoftware.jsap.stringparsers.BigDecimalStringParser
A
StringParser
for parsing BigDecimals. The parse() method delegates the
actual
parsing to BigDecimal's constructor.- Author:
- Marty Lamb
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BigDecimalStringParser
Returns aBigDecimalStringParser
.Parses the specified argument into a BigDecimal.Methods inherited from class com.martiansoftware.jsap.StringParser
setUp, tearDown
-
Constructor Details
-
BigDecimalStringParser
public BigDecimalStringParser()Deprecated.UsegetParser()
or, even better,JSAP.BIGDECIMAL_PARSER
.Creates a new BigDecimalStringParser.
-
-
Method Details
-
getParser
Returns aBigDecimalStringParser
.Convenient access to the only instance returned by this method is available through
JSAP.BIGDECIMAL_PARSER
.- Returns:
- a
BigDecimalStringParser
.
-
parse
Parses the specified argument into a BigDecimal. This method simply delegates the parsing tonew BigDecimal(String)
. If BigDecimal throws a NumberFormatException, it is encapsulated into a ParseException and re-thrown.- Specified by:
parse
in classStringParser
- Parameters:
arg
- the argument to parse- Returns:
- a BigDecimal object with the value contained in the specified argument.
- Throws:
ParseException
- ifnew BigDecimal(arg)
throws a NumberFormatException.- See Also:
-
getParser()
or, even better,JSAP.BIGDECIMAL_PARSER
.