public class ForNameStringParser extends StringParser
StringParser that passes the
argument to a static method of signature forName(String) of a specified class.
Note that, for instance, this parser can be used with Class (resulting in a
string parser identical to ClassStringParser),
but also Charset, and more generally, any class using the forName(String)
convention.
| Modifier and Type | Method and Description |
|---|---|
static ForNameStringParser |
getParser(java.lang.Class klass)
Returns a class
forName() string parser. |
java.lang.Object |
parse(java.lang.String arg)
Parses the specified argument into an Object of the appropriate type.
|
setUp, tearDownpublic static ForNameStringParser getParser(java.lang.Class klass) throws java.lang.SecurityException, java.lang.NoSuchMethodException
forName() string parser.
When required to parse an argument, the returned string parser will return the
object obtain by means of a call to a static method of klass of signature
forName(String).
klass - a class with a static method of signature forName(String).java.lang.SecurityExceptionjava.lang.NoSuchMethodExceptionpublic java.lang.Object parse(java.lang.String arg)
throws ParseException
StringParserparse in class StringParserarg - the argument to convert to an Object of class appropriate to
the StringParser subclass.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