com.jgpruitt.datamodeler.core
Class ColumnBuilder

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

public class ColumnBuilder
extends java.lang.Object

Fluent Builder class used to create instances of the Column class.

Author:
John Pruitt
See Also:
Column

Field Summary
protected  Column column
           
protected  TableBuilder tableBuilder
           
 
Constructor Summary
protected ColumnBuilder(java.lang.String name, TableBuilder tableBuilder)
          Constructor.
 
Method Summary
 ColumnBuilder BIT(int length)
          Sets the Column's DataType to BIT and the fixed-length.
 ColumnBuilder CHAR(int length)
          Sets the Column's DataType to CHAR and the fixed-length.
 ColumnBuilder comment(java.lang.String comment)
          Assigns a comment to the Column for use in the data dictionary.
 ColumnBuilder DATE()
          Sets the Column's DataType to DATE.
 ColumnBuilder DECIMAL(int precision, int scale)
          Sets the Column's DataType to DECIMAL and sets the precision and scale.
 TableBuilder done()
          Returns the TableBuilder for the Table to which the Column belongs.
 ColumnBuilder DOUBLE()
          Sets the Column's DataType to DOUBLE.
 ColumnBuilder FLOAT()
          Sets the Column's DataType to FLOAT.
 ColumnBuilder INT()
          Sets the Column's DataType to INT.
 ColumnBuilder NCHAR(int length)
          Sets the Column's DataType to NCHAR and the fixed-length.
 ColumnBuilder NOTNULL()
          Sets the Column to disallow NULL values.
 ColumnBuilder NULL()
          Sets the Column to allow NULL values.
 ColumnBuilder NUMERIC(int precision, int scale)
          Sets the Column's DataType to NUMERIC and sets the precision and scale.
 ColumnBuilder NVARCHAR(int length)
          Sets the Column's DataType to NVARCHAR and the variable-length.
 ColumnBuilder REAL()
          Sets the Column's DataType to REAL.
 ColumnBuilder SMALLINT()
          Sets the Column's DataType to SMALLINT.
 ColumnBuilder TIME()
          Sets the Column's DataType to TIME.
 ColumnBuilder TIMESTAMP()
          Sets the Column's DataType to TIMESTAMP.
 ColumnBuilder TIMESTAMPTZ()
          Sets the Column's DataType to TIMESTAMPTZ.
 ColumnBuilder TIMETZ()
          Sets the Column's DataType to TIMETZ.
 ColumnBuilder VARCHAR(int length)
          Sets the Column's DataType to VARCHAR and the variable-length.
 ColumnBuilder VBIT(int length)
          Sets the Column's DataType to VBIT and the variable-length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

column

protected final Column column

tableBuilder

protected final TableBuilder tableBuilder
Constructor Detail

ColumnBuilder

protected ColumnBuilder(java.lang.String name,
                        TableBuilder tableBuilder)
Constructor.

Parameters:
name - The name of the Column to create.
tableBuilder - A TableBuilder for the Table to which the new Column should belong.
Method Detail

done

public TableBuilder done()
Returns the TableBuilder for the Table to which the Column belongs.

Returns:
The TableBuilder
See Also:
TableBuilder

comment

public ColumnBuilder comment(java.lang.String comment)
Assigns a comment to the Column for use in the data dictionary.

Parameters:
comment - The comment string.
Returns:
Returns this ColumnBuilder for method chaining.

NULL

public ColumnBuilder NULL()
Sets the Column to allow NULL values.

Returns:
Returns this ColumnBuilder for method chaining.

NOTNULL

public ColumnBuilder NOTNULL()
Sets the Column to disallow NULL values.

Returns:
Returns this ColumnBuilder for method chaining.

CHAR

public ColumnBuilder CHAR(int length)
Sets the Column's DataType to CHAR and the fixed-length.

Parameters:
length - The length of the strings allowed in the Column.
Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

VARCHAR

public ColumnBuilder VARCHAR(int length)
Sets the Column's DataType to VARCHAR and the variable-length.

Parameters:
length - The maximum length of the strings allowed in the Column.
Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

NCHAR

public ColumnBuilder NCHAR(int length)
Sets the Column's DataType to NCHAR and the fixed-length.

Parameters:
length - The length of the strings allowed in the Column.
Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

NVARCHAR

public ColumnBuilder NVARCHAR(int length)
Sets the Column's DataType to NVARCHAR and the variable-length.

Parameters:
length - The maximum length of the strings allowed in the Column.
Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

BIT

public ColumnBuilder BIT(int length)
Sets the Column's DataType to BIT and the fixed-length.

Parameters:
length - The length of the bit array datatype.
Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

VBIT

public ColumnBuilder VBIT(int length)
Sets the Column's DataType to VBIT and the variable-length.

Parameters:
length - The maximum length of the bit array datatype.
Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

INT

public ColumnBuilder INT()
Sets the Column's DataType to INT.

Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

SMALLINT

public ColumnBuilder SMALLINT()
Sets the Column's DataType to SMALLINT.

Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

FLOAT

public ColumnBuilder FLOAT()
Sets the Column's DataType to FLOAT.

Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

REAL

public ColumnBuilder REAL()
Sets the Column's DataType to REAL.

Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

DOUBLE

public ColumnBuilder DOUBLE()
Sets the Column's DataType to DOUBLE.

Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

NUMERIC

public ColumnBuilder NUMERIC(int precision,
                             int scale)
Sets the Column's DataType to NUMERIC and sets the precision and scale.

Parameters:
precision - the total number of digits allowed in the value
scale - the number of decimal digits. should be less than precision.
Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

DECIMAL

public ColumnBuilder DECIMAL(int precision,
                             int scale)
Sets the Column's DataType to DECIMAL and sets the precision and scale.

Parameters:
precision - the total number of digits allowed in the value
scale - the number of decimal digits. should be less than precision.
Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

DATE

public ColumnBuilder DATE()
Sets the Column's DataType to DATE.

Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

TIME

public ColumnBuilder TIME()
Sets the Column's DataType to TIME.

Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

TIMETZ

public ColumnBuilder TIMETZ()
Sets the Column's DataType to TIMETZ.

Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

TIMESTAMP

public ColumnBuilder TIMESTAMP()
Sets the Column's DataType to TIMESTAMP.

Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType

TIMESTAMPTZ

public ColumnBuilder TIMESTAMPTZ()
Sets the Column's DataType to TIMESTAMPTZ.

Returns:
Returns this ColumnBuilder for method chaining.
See Also:
DataType