Class LongStringParser
java.lang.Object
com.martiansoftware.jsap.StringParser
com.martiansoftware.jsap.stringparsers.LongStringParser
public class LongStringParser extends StringParser
A
StringParser for parsing Longs. The parse() method delegates the actual
parsing to Long.decode(String).- Author:
- Marty Lamb
- See Also:
StringParser,Long
-
Constructor Summary
Constructors Constructor Description LongStringParser()Deprecated. -
Method Summary
Modifier and Type Method Description static LongStringParsergetParser()Returns aLongStringParser.java.lang.Objectparse(java.lang.String arg)Parses the specified argument into a Long.Methods inherited from class com.martiansoftware.jsap.StringParser
setUp, tearDownMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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:
parsein 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:
Long,StringParser.parse(String)
-
getParser()or, even better,JSAP.LONG_PARSER.