|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.martiansoftware.jsap.StringParser
Class responsible for converting Strings into Objects. Each subclass of
StringParser
is capable of parsing a String into a different class of object. To
extend JSAP to
recognize new data types, a new StringParser must be created for the new
type.
"List" options (such as your environment's PATH and CLASSPATH variables)
that contain
multiple values are split into individual value tokens prior to the calling
of the
StringParser's parse() method. For example, if you had a StringStringParser
parsing
your PATH environment variable, that StringStringParser's parse() method
would be
called once for each item in the list. As a result, each StringParser only
needs
to know how to create an object based upon a single, simple token.
Constructor Summary | |
StringParser()
|
Method Summary | |
abstract Object |
parse(String arg)
Parses the specified argument into an Object of the appropriate type. |
void |
setUp()
Performs any initialization not handled by this StringParser's constructor. |
void |
tearDown()
Performs any cleanup necessary for this StringParser. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StringParser()
Method Detail |
public void setUp() throws Exception
Exception
- if an initialization error occurs that should prevent
the Option containing this StringParser from being registered.public void tearDown()
public abstract Object parse(String arg) throws ParseException
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 |