|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectDefaultHandler
ExampleManager
public class ExampleManager
An example manager for facilitating access to example input files. This class allows the user to register example files and get Reader objects for reading from them conveniently.
TODO: Right now, the example manager's behaviour is undefined when there is more than one example with the same filename.
Nested Class Summary | |
---|---|
static class |
ExampleManager.ParserException
A parser exception that occurred while reading an examples specification file. |
Constructor Summary | |
---|---|
ExampleManager()
|
Method Summary | |
---|---|
void |
addAllExamples(String directory)
Adds all examples from a given example specification file. |
void |
addExample(String filename,
String directory,
String description)
Adds an example to the registry. |
String |
getDescriptionForExample(String example)
Returns the description for the example of the given name. |
List<String> |
getExampleNames()
Returns the list of all registered example names. |
Reader |
getExampleReader(String name)
Returns a Reader for the specified example file. |
void |
startElement(String uri,
String localName,
String qName,
Attributes attributes)
|
Methods inherited from class DefaultHandler |
---|
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExampleManager()
Method Detail |
---|
public List<String> getExampleNames()
public String getDescriptionForExample(String example)
example
-
public Reader getExampleReader(String name)
name
-
public void addAllExamples(String directory) throws ExampleManager.ParserException
<examples> <example filename="..." description="..." /> </examples>Each
example
element specifies a filename and a description
for one example file. The filename is interpreted relative to the
directory which contains the "examples.xml" file.
directory
- a directory containing a file with the name "examples.xml".
ExampleManager.ParserException
- if a parsing error occurred while reading
the XML file.public void addExample(String filename, String directory, String description)
filename
- directory
- description
- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
startElement
in class DefaultHandler
SAXException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |