Class FloatStringParser
- java.lang.Object
-
- com.martiansoftware.jsap.StringParser
-
- com.martiansoftware.jsap.stringparsers.FloatStringParser
-
public class FloatStringParser extends StringParser
AStringParser
for parsing Floats. Theparse()
method delegates the actual parsing tonew Float(String)
. Ifnew Float(String)
throws a NumberFormatException, it is encapsulated in a ParseException and re-thrown.- Author:
- Marty Lamb
- See Also:
StringParser
,Float
-
-
Constructor Summary
Constructors Constructor Description FloatStringParser()
Deprecated.UsegetParser()
or, even better,JSAP.FLOAT_PARSER
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FloatStringParser
getParser()
Returns aFloatStringParser
.java.lang.Object
parse(java.lang.String arg)
Parses the specified argument into a Float.-
Methods inherited from class com.martiansoftware.jsap.StringParser
setUp, tearDown
-
-
-
-
Constructor Detail
-
FloatStringParser
public FloatStringParser()
Deprecated.UsegetParser()
or, even better,JSAP.FLOAT_PARSER
.Creates a new FloatStringParser.
-
-
Method Detail
-
getParser
public static FloatStringParser getParser()
Returns aFloatStringParser
.Convenient access to the only instance returned by this method is available through
JSAP.FLOAT_PARSER
.- Returns:
- a
FloatStringParser
.
-
parse
public java.lang.Object parse(java.lang.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 classStringParser
- Parameters:
arg
- the argument to parse- Returns:
- a Float object with the value contained in the specified argument.
- Throws:
ParseException
- ifnew Float(arg)
throws a NumberFormatException.- See Also:
Float
,StringParser.parse(String)
-
-