Class LongStringParser
- java.lang.Object
-
- com.martiansoftware.jsap.StringParser
-
- com.martiansoftware.jsap.stringparsers.LongStringParser
-
public class LongStringParser extends StringParser
AStringParserfor parsing Longs. The parse() method delegates the actual parsing toLong.decode(String).- Author:
- Marty Lamb
- See Also:
StringParser,Long
-
-
Constructor Summary
Constructors Constructor Description LongStringParser()Deprecated.UsegetParser()or, even better,JSAP.LONG_PARSER.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LongStringParsergetParser()Returns aLongStringParser.Objectparse(String arg)Parses the specified argument into a Long.-
Methods inherited from class com.martiansoftware.jsap.StringParser
setUp, tearDown
-
-
-
-
Constructor Detail
-
LongStringParser
public LongStringParser()
Deprecated.UsegetParser()or, even better,JSAP.LONG_PARSER.Creates a new LongStringParser.
-
-
Method Detail
-
getParser
public static LongStringParser getParser()
Returns aLongStringParser.Convenient access to the only instance returned by this method is available through
JSAP.LONG_PARSER.- Returns:
- a
LongStringParser.
-
parse
public Object parse(String arg) throws ParseException
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)
-
-