de.mguennewig.pobjects.metadata
Class PObjDictionary

java.lang.Object
  extended by de.mguennewig.pobjects.metadata.PObjDictionary

public class PObjDictionary
extends java.lang.Object

A collection of Modules.

Author:
Michael Günnewig

Field Summary
static int NORMALIZE_CUT_OFF
          Normalize name by cut-off at the maximum length.
static int NORMALIZE_NO_VOWELS_40_60
          Normalize name by removing vowels.
 
Constructor Summary
PObjDictionary(Module[] modules, int normalizeName)
          Creates a new dictionary.
 
Method Summary
 java.lang.ClassLoader getClassLoader()
          Returns the ClassLoader that can load all database classes.
 Module getModule(int idx)
          Returns the Module at index idx.
 Module getModule(java.lang.String name)
          Returns the Module with the specified name or null if such does not exist.
 Module getModuleForPackage(java.lang.String packageName)
          Returns the Module for the specified package name or null if such does not exist.
 int getNormalizeName()
           
 int getNumModules()
          Returns the number of Modules in this collection.
 TableExpr getTableExpr(java.lang.Class<? extends Record> tableClass)
          Returns the table expression for the given class or null if such does not exist.
 TableExpr getTableExpr(java.lang.String tableName)
          Returns the first found table expression for the given name or null if such does not exist.
 java.lang.String normalizeName(java.lang.String name, int maxLength)
          Normalize name for the target database.
 void setClassLoader(java.lang.ClassLoader classLoader)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORMALIZE_CUT_OFF

public static final int NORMALIZE_CUT_OFF
Normalize name by cut-off at the maximum length.

See Also:
Constant Field Values

NORMALIZE_NO_VOWELS_40_60

public static final int NORMALIZE_NO_VOWELS_40_60
Normalize name by removing vowels.

If the name has more than the maximum length characters, then strip all vowels from the 4th, 5th, etc. character of the original name. If the remaining length still exceeds the maximum length characters, then take the first 40% and last 60% off characters.

See Also:
Constant Field Values
Constructor Detail

PObjDictionary

public PObjDictionary(Module[] modules,
                      int normalizeName)
Creates a new dictionary.

The ClassLoader for the database classes is guessed to be the same as the one for the PObjects library.

Method Detail

getNumModules

public final int getNumModules()
Returns the number of Modules in this collection.


getModule

public final Module getModule(int idx)
Returns the Module at index idx.


getModule

public final Module getModule(java.lang.String name)
Returns the Module with the specified name or null if such does not exist.


getModuleForPackage

public final Module getModuleForPackage(java.lang.String packageName)
Returns the Module for the specified package name or null if such does not exist.


getNormalizeName

public final int getNormalizeName()

normalizeName

public java.lang.String normalizeName(java.lang.String name,
                                      int maxLength)
Normalize name for the target database. Most importantly, make sure that its length does not exceed the allowed number of characters.


getTableExpr

public final TableExpr getTableExpr(java.lang.String tableName)
Returns the first found table expression for the given name or null if such does not exist.

See Also:
Module.getTableExpr(String)

getTableExpr

public final TableExpr getTableExpr(java.lang.Class<? extends Record> tableClass)
Returns the table expression for the given class or null if such does not exist.

See Also:
getModuleForPackage(String), Module.getTableExpr(String)

getClassLoader

public final java.lang.ClassLoader getClassLoader()
Returns the ClassLoader that can load all database classes.


setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)