com.healthmarketscience.jackcess
Class ColumnBuilder

java.lang.Object
  extended by com.healthmarketscience.jackcess.ColumnBuilder

public class ColumnBuilder
extends Object

Builder style class for constructing a Column. See TableBuilder for example usage.

Author:
James Ahlborn
Usage:
General: This class is general use.

Constructor Summary
ColumnBuilder(String name)
           
ColumnBuilder(String name, DataType type)
           
 
Method Summary
 ColumnBuilder escapeName()
          Escapes the new column's name using TableBuilder.escapeIdentifier(java.lang.String).
 short getColumnNumber()
           
 short getLength()
           
 String getName()
           
 byte getPrecision()
           
 byte getScale()
           
 ColumnImpl.SortOrder getTextSortOrder()
           
 DataType getType()
           
 boolean isAutoNumber()
           
 boolean isCompressedUnicode()
           
 boolean isHyperlink()
           
 ColumnBuilder setAutoNumber(boolean autoNumber)
          Sets whether of not the new column is an auto-number column.
 void setColumnNumber(short newColumnNumber)
           
 ColumnBuilder setCompressedUnicode(boolean compressedUnicode)
          Sets whether of not the new column allows unicode compression.
 ColumnBuilder setFromColumn(Column template)
          Sets all attributes except name from the given Column template.
 ColumnBuilder setFromColumn(ColumnBuilder template)
          Sets all attributes except name from the given Column template.
 ColumnBuilder setHyperlink(boolean hyperlink)
          Sets whether of not the new column allows unicode compression.
 ColumnBuilder setLength(int length)
          Sets the length (in bytes) for the new column.
 ColumnBuilder setLengthInUnits(int unitLength)
          Sets the length (in type specific units) for the new column.
 ColumnBuilder setMaxLength()
          Sets the length for the new column to the max length for the type.
 ColumnBuilder setPrecision(int newPrecision)
          Sets the precision for the new column.
 ColumnBuilder setScale(int newScale)
          Sets the scale for the new column.
 ColumnBuilder setSQLType(int type)
          Sets the type for the new column based on the given SQL type.
 ColumnBuilder setSQLType(int type, int lengthInUnits)
          Sets the type for the new column based on the given SQL type and target data length (in type specific units).
 void setTextSortOrder(ColumnImpl.SortOrder newTextSortOrder)
           
 ColumnBuilder setType(DataType type)
          Sets the type for the new column.
 ColumnBuilder toColumn()
          Creates a new Column with the currently configured attributes.
 void validate(JetFormat format)
          Checks that this column definition is valid.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColumnBuilder

public ColumnBuilder(String name)

ColumnBuilder

public ColumnBuilder(String name,
                     DataType type)
Method Detail

getName

public String getName()

setType

public ColumnBuilder setType(DataType type)
Sets the type for the new column.


getType

public DataType getType()

setSQLType

public ColumnBuilder setSQLType(int type)
                         throws SQLException
Sets the type for the new column based on the given SQL type.

Throws:
SQLException

setSQLType

public ColumnBuilder setSQLType(int type,
                                int lengthInUnits)
                         throws SQLException
Sets the type for the new column based on the given SQL type and target data length (in type specific units).

Throws:
SQLException

setPrecision

public ColumnBuilder setPrecision(int newPrecision)
Sets the precision for the new column.


getPrecision

public byte getPrecision()

setScale

public ColumnBuilder setScale(int newScale)
Sets the scale for the new column.


getScale

public byte getScale()

setLength

public ColumnBuilder setLength(int length)
Sets the length (in bytes) for the new column.


getLength

public short getLength()

setLengthInUnits

public ColumnBuilder setLengthInUnits(int unitLength)
Sets the length (in type specific units) for the new column.


setMaxLength

public ColumnBuilder setMaxLength()
Sets the length for the new column to the max length for the type.


setAutoNumber

public ColumnBuilder setAutoNumber(boolean autoNumber)
Sets whether of not the new column is an auto-number column.


isAutoNumber

public boolean isAutoNumber()

setCompressedUnicode

public ColumnBuilder setCompressedUnicode(boolean compressedUnicode)
Sets whether of not the new column allows unicode compression.


isCompressedUnicode

public boolean isCompressedUnicode()

setHyperlink

public ColumnBuilder setHyperlink(boolean hyperlink)
Sets whether of not the new column allows unicode compression.


isHyperlink

public boolean isHyperlink()

setFromColumn

public ColumnBuilder setFromColumn(Column template)
Sets all attributes except name from the given Column template.


setFromColumn

public ColumnBuilder setFromColumn(ColumnBuilder template)
Sets all attributes except name from the given Column template.


escapeName

public ColumnBuilder escapeName()
Escapes the new column's name using TableBuilder.escapeIdentifier(java.lang.String).


getColumnNumber

public short getColumnNumber()
Usage:
Advanced: This method is for advanced/internal use.

setColumnNumber

public void setColumnNumber(short newColumnNumber)
Usage:
Advanced: This method is for advanced/internal use.

getTextSortOrder

public ColumnImpl.SortOrder getTextSortOrder()
Usage:
Advanced: This method is for advanced/internal use.

setTextSortOrder

public void setTextSortOrder(ColumnImpl.SortOrder newTextSortOrder)
Usage:
Advanced: This method is for advanced/internal use.

validate

public void validate(JetFormat format)
Checks that this column definition is valid.

Throws:
IllegalArgumentException - if this column definition is invalid.
Usage:
Advanced: This method is for advanced/internal use.

toColumn

public ColumnBuilder toColumn()
Creates a new Column with the currently configured attributes.



Copyright © 2005-2013 Health Market Science. All Rights Reserved.