Class LongStringParser
java.lang.Object
com.martiansoftware.jsap.StringParser
com.martiansoftware.jsap.stringparsers.LongStringParser
A
StringParser
for parsing Longs. The parse() method delegates the actual
parsing to Long.decode(String)
.- Author:
- Marty Lamb
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LongStringParser
Returns aLongStringParser
.Parses the specified argument into a Long.Methods inherited from class com.martiansoftware.jsap.StringParser
setUp, tearDown
-
Constructor Details
-
LongStringParser
public LongStringParser()Deprecated.UsegetParser()
or, even better,JSAP.LONG_PARSER
.Creates a new LongStringParser.
-
-
Method Details
-
getParser
Returns aLongStringParser
.Convenient access to the only instance returned by this method is available through
JSAP.LONG_PARSER
.- Returns:
- a
LongStringParser
.
-
parse
Parses the specified argument into a Long. This method delegates the parsing toLong.decode(arg)
. IfLong.decode()
throws a NumberFormatException, it is encapsulated into a ParseException and re-thrown.- Specified by:
parse
in classStringParser
- Parameters:
arg
- the argument to parse- Returns:
- a Long object with the value contained in the specified argument.
- Throws:
ParseException
- ifLong.decode(arg)
throws a NumberFormatException.- See Also:
-
getParser()
or, even better,JSAP.LONG_PARSER
.