public class ColumnBuilder
extends java.lang.Object
Column. See TableBuilder for example usage.| Modifier and Type | Field and Description |
|---|---|
private boolean |
_autoNumber
whether or not the column is auto-number
|
private boolean |
_calculated
whether or not the column is calculated
|
private short |
_columnNumber
0-based column number
|
private boolean |
_compressedUnicode
whether or not the column allows compressed unicode
|
private boolean |
_hyperlink
whether or not the column is a hyperlink (memo only)
|
private java.lang.Short |
_length
optional length for the new column
|
private java.lang.String |
_name
name of the new column
|
private java.lang.Byte |
_precision
optional precision for the new column
|
private java.util.Map<java.lang.String,PropertyMap.Property> |
_props
table properties (if any)
|
private java.lang.Byte |
_scale
optional scale for the new column
|
private ColumnImpl.SortOrder |
_sortOrder
the collating sort order for a text field
|
private DataType |
_type
the type of the new column
|
| Constructor and Description |
|---|
ColumnBuilder(java.lang.String name) |
ColumnBuilder(java.lang.String name,
DataType type) |
| Modifier and Type | Method and Description |
|---|---|
ColumnBuilder |
escapeName()
Escapes the new column's name using
TableBuilder.escapeIdentifier(java.lang.String). |
short |
getColumnNumber() |
short |
getLength() |
java.lang.String |
getName() |
byte |
getPrecision() |
java.util.Map<java.lang.String,PropertyMap.Property> |
getProperties() |
private PropertyMap.Property |
getProperty(java.lang.String name) |
byte |
getScale() |
ColumnImpl.SortOrder |
getTextSortOrder() |
DataType |
getType() |
boolean |
isAutoNumber() |
boolean |
isCalculated() |
boolean |
isCompressedUnicode() |
boolean |
isHyperlink() |
boolean |
isVariableLength() |
ColumnBuilder |
putProperty(java.lang.String name,
DataType type,
java.lang.Object value)
Sets the column property with the given name and type to the given value.
|
ColumnBuilder |
putProperty(java.lang.String name,
java.lang.Object value)
Sets the column property with the given name to the given value.
|
ColumnBuilder |
setAutoNumber(boolean autoNumber)
Sets whether of not the new column is an auto-number column.
|
ColumnBuilder |
setCalculated(boolean calculated)
Sets whether of not the new column is a calculated column.
|
ColumnBuilder |
setCalculatedInfo(java.lang.String expression)
Convenience method to set the various info for a calculated type (flag,
result type property and expression)
|
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 (including
all column properties except GUID).
|
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 |
setMaxPrecision()
Sets the precision for the new column to the max length for the type.
|
ColumnBuilder |
setMaxScale()
Sets the scale for the new column to the max length for the type.
|
ColumnBuilder |
setPrecision(int newPrecision)
Sets the precision for the new column.
|
private void |
setProperty(java.lang.String name,
PropertyMap.Property prop) |
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.
|
private java.lang.String |
withErrorContext(java.lang.String msg) |
private java.lang.String _name
private DataType _type
private java.lang.Short _length
private java.lang.Byte _precision
private java.lang.Byte _scale
private boolean _autoNumber
private boolean _compressedUnicode
private boolean _calculated
private boolean _hyperlink
private short _columnNumber
private ColumnImpl.SortOrder _sortOrder
private java.util.Map<java.lang.String,PropertyMap.Property> _props
public ColumnBuilder(java.lang.String name)
public ColumnBuilder(java.lang.String name,
DataType type)
public java.lang.String getName()
public ColumnBuilder setType(DataType type)
public DataType getType()
public ColumnBuilder setSQLType(int type) throws java.sql.SQLException
java.sql.SQLExceptionpublic ColumnBuilder setSQLType(int type, int lengthInUnits) throws java.sql.SQLException
java.sql.SQLExceptionpublic ColumnBuilder setPrecision(int newPrecision)
public byte getPrecision()
public ColumnBuilder setMaxPrecision()
public ColumnBuilder setScale(int newScale)
public byte getScale()
public ColumnBuilder setMaxScale()
public ColumnBuilder setLength(int length)
public short getLength()
public ColumnBuilder setLengthInUnits(int unitLength)
public ColumnBuilder setMaxLength()
public ColumnBuilder setAutoNumber(boolean autoNumber)
public boolean isAutoNumber()
public ColumnBuilder setCompressedUnicode(boolean compressedUnicode)
public boolean isCompressedUnicode()
public ColumnBuilder setCalculated(boolean calculated)
public boolean isCalculated()
public ColumnBuilder setCalculatedInfo(java.lang.String expression)
public boolean isVariableLength()
public ColumnBuilder setHyperlink(boolean hyperlink)
public boolean isHyperlink()
public ColumnBuilder putProperty(java.lang.String name, java.lang.Object value)
PropertyMap.put(String,Object) for details on determining the
property type).public ColumnBuilder putProperty(java.lang.String name, DataType type, java.lang.Object value)
public java.util.Map<java.lang.String,PropertyMap.Property> getProperties()
private void setProperty(java.lang.String name,
PropertyMap.Property prop)
private PropertyMap.Property getProperty(java.lang.String name)
public ColumnBuilder setFromColumn(Column template) throws java.io.IOException
java.io.IOExceptionpublic ColumnBuilder setFromColumn(ColumnBuilder template)
public ColumnBuilder escapeName()
TableBuilder.escapeIdentifier(java.lang.String).public short getColumnNumber()
public void setColumnNumber(short newColumnNumber)
public ColumnImpl.SortOrder getTextSortOrder()
public void setTextSortOrder(ColumnImpl.SortOrder newTextSortOrder)
public void validate(JetFormat format)
java.lang.IllegalArgumentException - if this column definition is invalid.public ColumnBuilder toColumn()
private java.lang.String withErrorContext(java.lang.String msg)