Class IntegerStringParser
java.lang.Object
com.martiansoftware.jsap.StringParser
com.martiansoftware.jsap.stringparsers.IntegerStringParser
A
StringParser
for parsing Integers. The parse() method delegates the actual
parsing to Integer.decode(String).- Author:
- Marty Lamb
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IntegerStringParser
Returns aIntegerStringParser
.Parses the specified argument into an Integer.Methods inherited from class com.martiansoftware.jsap.StringParser
setUp, tearDown
-
Constructor Details
-
IntegerStringParser
public IntegerStringParser()Deprecated.UsegetParser()
or, even better,JSAP.INTEGER_PARSER
.Creates a new IntegerStringParser.
-
-
Method Details
-
getParser
Returns aIntegerStringParser
.Convenient access to the only instance returned by this method is available through
JSAP.INTEGER_PARSER
.- Returns:
- a
IntegerStringParser
.
-
parse
Parses the specified argument into an Integer. This method delegates the parsing toInteger.decode(arg)
. IfInteger.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:
- an Integer object with the value contained in the specified argument.
- Throws:
ParseException
- ifInteger.decode(arg)
throws a NumberFormatException.- See Also:
-
getParser()
or, even better,JSAP.INTEGER_PARSER
.