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