Class DoubleStringParser
java.lang.Object
com.martiansoftware.jsap.StringParser
com.martiansoftware.jsap.stringparsers.DoubleStringParser
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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DoubleStringParser
Returns aDoubleStringParser
.Parses the specified argument into a Double.Methods inherited from class com.martiansoftware.jsap.StringParser
setUp, tearDown
-
Constructor Details
-
DoubleStringParser
public DoubleStringParser()Deprecated.UsegetParser()
or, even better,JSAP.DOUBLE_PARSER
.Creates a new DoubleStringParser.
-
-
Method Details
-
getParser
Returns aDoubleStringParser
.Convenient access to the only instance returned by this method is available through
JSAP.DOUBLE_PARSER
.- Returns:
- a
DoubleStringParser
.
-
parse
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 classStringParser
- Parameters:
arg
- the argument to parse- Returns:
- a Double object with the value contained in the specified argument.
- Throws:
ParseException
- ifnew Double(arg)
throws a NumberFormatException.- See Also:
-
getParser()
or, even better,JSAP.DOUBLE_PARSER
.