|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.mcdermottroe.exemplar.input.InputUtils
public final class InputUtils
Input handling utilities.
| Constructor Summary | |
|---|---|
private |
InputUtils()
Private constructor to prevent instantiation of this class. |
| Method Summary | |
|---|---|
static SortedMap<String,String> |
availableInputLanguages()
Find out the available input languages. |
static XMLDocumentType |
parse(String inputFile,
String inputType)
Given an input file and the type of that file, create the XMLDocumentType for it. |
private static Class<?> |
parserClass(String name)
Locate the input parsing class for a given input module. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
private InputUtils()
| Method Detail |
|---|
private static Class<?> parserClass(String name)
throws ClassNotFoundException
InputModule interface.
name - The name of the input module. The class
returned will be
$PACKAGE.input.$name.Parser.
ClassNotFoundException - When the class
$PACKAGE.input.$name.Parser could not be
found.
public static XMLDocumentType parse(String inputFile,
String inputType)
throws InputException,
ParserException
XMLDocumentType for it. This method hides away the implementations of
the input modules to allow a plug-in style way of accessing them.
Students of design patterns will recognise this as something like the
Abstract Factory pattern (with InputModule as the abstract
interface. However, this goes one step further by invoking the InputModule.parse(String) method on the created class.
inputFile - The input file.inputType - The type of file inputFile is.
XMLDocumentType describing the
vocabulary of XML that was contained in
inputFile.
InputException - if the parsing method did not conform to the
required interface or was otherwise
inaccessible.
ParserException - if an error was thrown inside the parser.public static SortedMap<String,String> availableInputLanguages()
Packages.findSubPackages(java.lang.String) method to find all of the packages
below Constants.Input.PACKAGE which
are in the prescribed form.
SortedMap where the keys are tokens representing
legal input languages and the values are descriptions of those
languages.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||