com.martiansoftware.jsap.stringparsers
Class IntSizeStringParser

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

public class IntSizeStringParser
extends StringParser

A StringParser that works like LongSizeStringParser, but additionally checks that the result is not larger than Integer.MAX_VALUE.

Author:
Sebastiano Vigna

Method Summary
static IntSizeStringParser getParser()
          Returns the only instance of an IntSizeStringParser.
 Object parse(String arg)
          Parses the specified argument into an Object of the appropriate type.
 
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
 

Method Detail

getParser

public static IntSizeStringParser getParser()
Returns the only instance of an IntSizeStringParser.

Convenient access to the only instance returned by this method is available through JSAP.INTSIZE_PARSER.

Returns:
the only instance of an IntSizeStringParser.

parse

public Object parse(String arg)
             throws ParseException
Description copied from class: StringParser
Parses the specified argument into an Object of the appropriate type. If the specified argument cannot be converted into the desired Object, a ParseException should be thrown.

Note: this method MAY BE CALLED with a null argument. Take this into consideration when subclassing!

Specified by:
parse in class StringParser
Parameters:
arg - the argument to convert to an Object of class appropriate to the StringParser subclass.
Returns:
the Object resulting from the parsed argument.
Throws:
ParseException - if the specified argument cannot be parsed.


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