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