com.martiansoftware.jsap.stringparsers
Class FloatStringParser

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

public class FloatStringParser
extends StringParser

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

Author:
Marty Lamb
See Also:
StringParser, Float

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

FloatStringParser

public FloatStringParser()
Deprecated. Use getParser() or, even better, JSAP.FLOAT_PARSER.

Creates a new FloatStringParser.

Method Detail

getParser

public static FloatStringParser getParser()
Returns a FloatStringParser.

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

Returns:
a FloatStringParser.

parse

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

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