Class BigDecimalStringParser
- java.lang.Object
-
- com.martiansoftware.jsap.StringParser
-
- com.martiansoftware.jsap.stringparsers.BigDecimalStringParser
-
public class BigDecimalStringParser extends StringParser
AStringParser
for parsing BigDecimals. The parse() method delegates the actual parsing to BigDecimal's constructor.- Author:
- Marty Lamb
- See Also:
StringParser
,BigDecimal
-
-
Constructor Summary
Constructors Constructor Description BigDecimalStringParser()
Deprecated.UsegetParser()
or, even better,JSAP.BIGDECIMAL_PARSER
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BigDecimalStringParser
getParser()
Returns aBigDecimalStringParser
.java.lang.Object
parse(java.lang.String arg)
Parses the specified argument into a BigDecimal.-
Methods inherited from class com.martiansoftware.jsap.StringParser
setUp, tearDown
-
-
-
-
Constructor Detail
-
BigDecimalStringParser
public BigDecimalStringParser()
Deprecated.UsegetParser()
or, even better,JSAP.BIGDECIMAL_PARSER
.Creates a new BigDecimalStringParser.
-
-
Method Detail
-
getParser
public static BigDecimalStringParser getParser()
Returns aBigDecimalStringParser
.Convenient access to the only instance returned by this method is available through
JSAP.BIGDECIMAL_PARSER
.- Returns:
- a
BigDecimalStringParser
.
-
parse
public java.lang.Object parse(java.lang.String arg) throws ParseException
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:
BigDecimal
,StringParser.parse(String)
-
-