public class ColumnBuilder extends Object
Column
. See TableBuilder
for example usage. Additionally, a Column can be added to an
existing Table using the addToTable(Table)
method.TableBuilder
Constructor and Description |
---|
ColumnBuilder(String name) |
ColumnBuilder(String name,
DataType type) |
Modifier and Type | Method and Description |
---|---|
Column |
addToTable(Table table)
Adds a new Column to the given Table with the currently configured
attributes.
|
Column |
addToTableDefinition(TableDefinition table)
Adds a new Column to the given TableDefinition with the currently
configured attributes.
|
ColumnBuilder |
escapeName()
Escapes the new column's name using
TableBuilder.escapeIdentifier(java.lang.String) . |
short |
getColumnNumber() |
short |
getLength() |
String |
getName() |
byte |
getPrecision() |
Map<String,PropertyMap.Property> |
getProperties() |
byte |
getScale() |
ColumnImpl.SortOrder |
getTextSortOrder() |
DataType |
getType() |
boolean |
isAutoNumber() |
boolean |
isCalculated() |
boolean |
isCompressedUnicode() |
boolean |
isHyperlink() |
boolean |
isVariableLength() |
ColumnBuilder |
putProperty(String name,
DataType type,
Object value)
Sets the column property with the given name and type to the given value.
|
ColumnBuilder |
putProperty(String name,
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(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.
|
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).
|
ColumnBuilder |
setSQLType(int type,
int lengthInUnits,
Database.FileFormat fileFormat)
Sets the type for the new column based on the given SQL type, target
data length (in type specific units), and target FileFormat.
|
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.
|
public ColumnBuilder(String name)
public String getName()
public ColumnBuilder setType(DataType type)
public DataType getType()
public ColumnBuilder setSQLType(int type) throws IOException
IOException
public ColumnBuilder setSQLType(int type, int lengthInUnits) throws IOException
IOException
public ColumnBuilder setSQLType(int type, int lengthInUnits, Database.FileFormat fileFormat) throws IOException
IOException
public 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(String expression)
public boolean isVariableLength()
public ColumnBuilder setHyperlink(boolean hyperlink)
public boolean isHyperlink()
public ColumnBuilder putProperty(String name, Object value)
PropertyMap.put(String,Object)
for details on determining the
property type).public ColumnBuilder putProperty(String name, DataType type, Object value)
public Map<String,PropertyMap.Property> getProperties()
public ColumnBuilder setFromColumn(Column template) throws IOException
IOException
public 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)
IllegalArgumentException
- if this column definition is invalid.public ColumnBuilder toColumn()
public Column addToTable(Table table) throws IOException
IOException
public Column addToTableDefinition(TableDefinition table) throws IOException
IOException
Copyright © 2005–2024 OpenHMS. All rights reserved.