com.martiansoftware.jsap.stringparsers
Class ShortStringParser

java.lang.Object
  extended bycom.martiansoftware.jsap.StringParser
      extended bycom.martiansoftware.jsap.stringparsers.ShortStringParser

public class ShortStringParser
extends StringParser

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:
StringParser, BigDecimal

Constructor Summary
ShortStringParser()
          Deprecated. Use getParser() or, even better, JSAP.SHORT_PARSER.
 
Method Summary
static ShortStringParser getParser()
          Returns a ShortStringParser.
 Object parse(String arg)
          Parses the specified argument into a Short.
 
Methods inherited from class com.martiansoftware.jsap.StringParser
setUp, tearDown
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShortStringParser

public ShortStringParser()
Deprecated. Use getParser() or, even better, JSAP.SHORT_PARSER.

Creates a new ShortStringParser.

Method Detail

getParser

public static ShortStringParser getParser()
Returns a ShortStringParser.

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 to Short.decode(String). If Short.decode() throws a NumberFormatException, it is encapsulated in a ParseException and re-thrown.

Specified by:
parse in class StringParser
Parameters:
arg - the argument to parse
Returns:
a Short object with the value contained in the specified argument.
Throws:
ParseException - if Short.decode(arg) throws a NumberFormatException.
See Also:
Short, StringParser.parse(String)


Copyright © 2002-2006, Martian Software, Inc.. All Rights Reserved.
For the latest version and documentation, please visit http://www.martiansoftware.com/jsap