com.jgpruitt.datamodeler.core
Class ForeignKeyBuilder

java.lang.Object
  extended by com.jgpruitt.datamodeler.core.ForeignKeyBuilder

public class ForeignKeyBuilder
extends java.lang.Object

Fluent Builder class for creating ForeignKeys.

Author:
John Pruitt
See Also:
ForeignKey

Field Summary
protected  ForeignKey foreignKey
           
protected  ModelBuilder modelBuilder
           
 
Constructor Summary
protected ForeignKeyBuilder(java.lang.String name, ModelBuilder modelBuilder)
          Constructor.
 
Method Summary
 ForeignKeyBuilder comment(java.lang.String comment)
          Sets the comment on the ForeignKey
 ForeignKeyBuilder constrain(java.lang.String tableName, java.lang.String... columns)
          Sets the constrained Table and Columns
 ModelBuilder done()
          Gets the ModelBuilder
 ForeignKeyBuilder reference(java.lang.String tableName, java.lang.String... columns)
          Sets the referenced Table and Columns
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

foreignKey

protected final ForeignKey foreignKey

modelBuilder

protected final ModelBuilder modelBuilder
Constructor Detail

ForeignKeyBuilder

protected ForeignKeyBuilder(java.lang.String name,
                            ModelBuilder modelBuilder)
Constructor.

Parameters:
name - The name of the ForeignKey to create
modelBuilder - The ModelBuilder to which the ForeignKeys will be added.
See Also:
ModelBuilder
Method Detail

done

public ModelBuilder done()
Gets the ModelBuilder

Returns:
the ModelBuilder
See Also:
ModelBuilder

comment

public ForeignKeyBuilder comment(java.lang.String comment)
Sets the comment on the ForeignKey

Parameters:
comment - The comment describing the ForeignKey
Returns:
This ForeignKeyBuilder

constrain

public ForeignKeyBuilder constrain(java.lang.String tableName,
                                   java.lang.String... columns)
Sets the constrained Table and Columns

Parameters:
tableName - The name of the Table being constrained by this ForeignKey
columns - The names of the Columns being constrained by this ForeignKey
Returns:
This ForeignKeyBuilder

reference

public ForeignKeyBuilder reference(java.lang.String tableName,
                                   java.lang.String... columns)
Sets the referenced Table and Columns

Parameters:
tableName - The name of the Table being referenced by this ForeignKey
columns - The names of the Columns being referenced by this ForeignKey
Returns:
This ForeignKeyBuilder