com.martiansoftware.jsap.stringparsers
Class DoubleStringParser

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

public class DoubleStringParser
extends StringParser

A StringParser for parsing Doubles. The parse() method delegates the actual parsing to new Double(String). If a NumberFormatException is thrown by new Double(String), it is encapsulated in a ParseException and re-thrown.

Author:
Marty Lamb
See Also:
StringParser, Double

Constructor Summary
DoubleStringParser()
          Deprecated. Use getParser() or, even better, JSAP.DOUBLE_PARSER.
 
Method Summary
static DoubleStringParser getParser()
          Returns a DoubleStringParser.
 Object parse(String arg)
          Parses the specified argument into a Double.
 
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

DoubleStringParser

public DoubleStringParser()
Deprecated. Use getParser() or, even better, JSAP.DOUBLE_PARSER.

Creates a new DoubleStringParser.

Method Detail

getParser

public static DoubleStringParser getParser()
Returns a DoubleStringParser.

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

Returns:
a DoubleStringParser.

parse

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

Specified by:
parse in class StringParser
Parameters:
arg - the argument to parse
Returns:
a Double object with the value contained in the specified argument.
Throws:
ParseException - if new Double(arg) throws a NumberFormatException.
See Also:
Double, 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