|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.martiansoftware.jsap.StringParser com.martiansoftware.jsap.stringparsers.ForNameStringParser
A 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.
Method Summary | |
static ForNameStringParser |
getParser(Class klass)
Returns a class forName() string parser. |
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 |
public static ForNameStringParser getParser(Class klass) throws SecurityException, 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)
.
SecurityException
NoSuchMethodException
public Object parse(String arg) throws ParseException
StringParser
parse
in class StringParser
arg
- the argument to convert to an Object of class appropriate to
the StringParser subclass.
ParseException
- if the specified argument cannot be parsed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |