org.javagen.agile.db.visitor
Class DatabaseWalker
java.lang.Object
org.javagen.agile.db.visitor.DatabaseWalker
public class DatabaseWalker
- extends Object
Traversal part of visitor pattern as applied to database hierarchy.
CAUTION: For some applications it may be necessary to walks the tree twice to avoid null references.
Once to visit tables and columns and a
second pass to visit the foreign keys and their references after all tables/columns have been processed.
In these situations implement the Generator interface like so:
public void gen(Model database) {
DatabaseWalker.walk(database, visitor, DatabaseVisitor.NON_FK_MODEL_TYPES);
DatabaseWalker.walk(database, visitor, DatabaseVisitor.FK_ONLY_MODEL_TYPES);
return database;
}
- Author:
- Richard Easterling
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DatabaseWalker
public DatabaseWalker()
walk
public static void walk(Database database,
DatabaseVisitor visitor)
- Walk the database model tree using the visitor's itinerary.
- Parameters:
database - root node of the treevisitor - implementation to apply to the tree
walk
public static void walk(Model model,
DatabaseVisitor visitor,
Set<String> itinerary)
Copyright 2006-2006-2007 Outsource Cafe Inc.. All Rights Reserved.