com.martiansoftware.jsap.stringparsers
Class BigDecimalStringParser

java.lang.Object
  extended bycom.martiansoftware.jsap.StringParser
      extended bycom.martiansoftware.jsap.stringparsers.BigDecimalStringParser

public class BigDecimalStringParser
extends StringParser

A StringParser for parsing BigDecimals. The parse() method delegates the actual parsing to BigDecimal's constructor.

Author:
Marty Lamb
See Also:
StringParser, BigDecimal

Constructor Summary
BigDecimalStringParser()
          Deprecated. Use getParser() or, even better, JSAP.BIGDECIMAL_PARSER.
 
Method Summary
static BigDecimalStringParser getParser()
          Returns a BigDecimalStringParser.
 Object parse(String arg)
          Parses the specified argument into a BigDecimal.
 
Methods inherited from class com.martiansoftware.jsap.StringParser
setUp, tearDown
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BigDecimalStringParser

public BigDecimalStringParser()
Deprecated. Use getParser() or, even better, JSAP.BIGDECIMAL_PARSER.

Creates a new BigDecimalStringParser.

Method Detail

getParser

public static BigDecimalStringParser getParser()
Returns a BigDecimalStringParser.

Convenient access to the only instance returned by this method is available through JSAP.BIGDECIMAL_PARSER.

Returns:
a BigDecimalStringParser.

parse

public Object parse(String arg)
             throws ParseException
Parses the specified argument into a BigDecimal. This method simply delegates the parsing to new BigDecimal(String). If BigDecimal throws a NumberFormatException, it is encapsulated into a ParseException and re-thrown.

Specified by:
parse in class StringParser
Parameters:
arg - the argument to parse
Returns:
a BigDecimal object with the value contained in the specified argument.
Throws:
ParseException - if new BigDecimal(arg) throws a NumberFormatException.
See Also:
BigDecimal, StringParser.parse(String)


Copyright © 2002-2006, Martian Software, Inc.. All Rights Reserved.
For the latest version and documentation, please visit http://www.martiansoftware.com/jsap