de.mguennewig.pobjtool
Class DictionaryParser

java.lang.Object
  extended by de.mguennewig.pobjtool.DictionaryParser

public class DictionaryParser
extends java.lang.Object

A parser for the XML file that declares a PObjDictionary.

Author:
Michael Günnewig

Constructor Summary
DictionaryParser(DataDefinition dataDef)
          Creates a new data definition file parser that does not resolve type classes.
DictionaryParser(DataDefinition dataDef, boolean resolveTypeClass)
          Creates a new data definition file parser.
 
Method Summary
static java.lang.String getJavaPackage(org.w3c.dom.Element node, java.lang.String attr, java.lang.String defaultValue)
           
 boolean getResolveTypeClass()
          Returns whether this parser will resolve the type class of each type.
 PObjDictionary parseFile(java.io.File file)
          Parses the XML file with the specification of a PObjDictionary.
 PObjDictionary parseFile(java.lang.String filename)
          Parses the XML file with the specification of a PObjDictionary.
static boolean reservedInClass(java.lang.String name, boolean schemaName)
          Tests whether the name is reserved as a field.
static boolean reservedInModule(java.lang.String name)
          Tests whether the module name is revered.
static boolean validIdent(java.lang.String ident, boolean innerDot)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DictionaryParser

public DictionaryParser(DataDefinition dataDef)
Creates a new data definition file parser that does not resolve type classes.


DictionaryParser

public DictionaryParser(DataDefinition dataDef,
                        boolean resolveTypeClass)
Creates a new data definition file parser.

Method Detail

getResolveTypeClass

public final boolean getResolveTypeClass()
Returns whether this parser will resolve the type class of each type.

With resolving the type class is meant that not the default type class for the specified data type will be used, but an instance of the type class as specified in the dictionary file.

Note however that the dictionary parser must be able to find every type class as specified in the file if this method returns true, as otherwise the parser will fail.


parseFile

public PObjDictionary parseFile(java.lang.String filename)
                         throws java.io.IOException,
                                DictionaryException
Parses the XML file with the specification of a PObjDictionary.

Throws:
java.io.IOException - when an IO error occurs.
DictionaryException - when the XML file contains an error.

parseFile

public PObjDictionary parseFile(java.io.File file)
                         throws java.io.IOException,
                                DictionaryException
Parses the XML file with the specification of a PObjDictionary.

Throws:
java.io.IOException - when an IO error occurs.
DictionaryException - when the XML file contains an error.

reservedInModule

public static boolean reservedInModule(java.lang.String name)
Tests whether the module name is revered.


reservedInClass

public static boolean reservedInClass(java.lang.String name,
                                      boolean schemaName)
Tests whether the name is reserved as a field.


validIdent

public static boolean validIdent(java.lang.String ident,
                                 boolean innerDot)

getJavaPackage

public static java.lang.String getJavaPackage(org.w3c.dom.Element node,
                                              java.lang.String attr,
                                              java.lang.String defaultValue)
                                       throws DictionaryException
Throws:
DictionaryException