com.martiansoftware.jsap.stringparsers
Class PackageStringParser

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

public class PackageStringParser
extends StringParser

A StringParser for parsing Packages. The parse() method delegates the actual parsing to Package.getPackage(String), and returns the resulting Package object. If Package.getPackage() returns null, a ParseException is thrown.

Author:
Marty Lamb
See Also:
StringParser, Package

Constructor Summary
PackageStringParser()
          Deprecated. Use getParser() or, even better, JSAP.PACKAGE_PARSER.
 
Method Summary
static PackageStringParser getParser()
          Returns a PackageStringParser.
 Object parse(String arg)
          Parses the specified argument into a Package object.
 
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

PackageStringParser

public PackageStringParser()
Deprecated. Use getParser() or, even better, JSAP.PACKAGE_PARSER.

Creates a new PackageStringParser

Method Detail

getParser

public static PackageStringParser getParser()
Returns a PackageStringParser.

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

Returns:
a PackageStringParser.

parse

public Object parse(String arg)
             throws ParseException
Parses the specified argument into a Package object. This method delegates the parsing to Package.getPackage(String), and returns the resulting Package object. If Package.getPackage() returns null, a ParseException is thrown.

Specified by:
parse in class StringParser
Parameters:
arg - the argument to parse
Returns:
a Package object representing the specified package.
Throws:
ParseException - if Package.getPackage(arg) returns null.
See Also:
Package, 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