DataColumn
Leave feedback
On this page
Inheritance: java.lang.Object
public final class DataColumn
Represents the schema of a column in a DataTable.
| Constructor | Description |
|---|---|
| DataColumn() | Initializes a new instance of a DataColumn class as type string. |
| DataColumn(String columnName) | Inititalizes a new instance of the DataColumn class, as type string, using the specified column name. |
| DataColumn(String name, DataTable table) | Initializes a new instance of the @{link DataColumn} class using the specified column name and table it belongs to. |
| DataColumn(String columnName, Class dataType) | Inititalizes a new instance of the DataColumn class using the specified column name and data type. |
| DataColumn(String name, Class type, DataTable table) | Initializes a new instance of the DataColumn class using the specified column name, data type and data table it belongs to. |
| Method | Description |
|---|---|
| getColumnName() | Gets the name of the column in the DataColumnCollection. |
| setColumnName(String value) | Sets the name of the column in the DataColumnCollection. |
| getAllowDBNull() | Gets a value that indicates whether null values are allowed in this column for rows that belong to the table. |
| setAllowDBNull(boolean value) | Sets a value that indicates whether null values are allowed in this column for rows that belong to the table. |
| getDataType() | Gets the type of data stored in the column. |
| setDataType(Class value) | Sets the type of data stored in the column. |
| setDefaultValue(Object value) | Sets the default value for the column when you are creating new rows. |
| getDefaultValue() | Gets the default value for the column when you are creating new rows. |
| getOrdinal() | Gets the position of the column in the DataColumnCollection collection. |
| setOrdinal(int ordinal) | Changes the ordinal or position of the DataColumn to the specified ordinal or position. |
| getColumnMapping() | Gets the MappingType of the column. |
| setColumnMapping(int value) | Sets the MappingType of the column. |
| getNamespace() | Gets the namespace of the DataColumn. |
| setNamespace(String value) | Sets the namespace of the DataColumn. |
| getPrefix() | Gets an XML prefix that aliases the namespace of the DataTable. |
| setPrefix(String value) | Sets an XML prefix that aliases the namespace of the DataTable. |
| getTable() | Gets the DataTable to which the column belongs to. |
| getAutoIncrement() | Gets a value that indicates whether the column automatically increments the value of the column for new rows added to the table. |
| setAutoIncrement(boolean value) | Sets a value that indicates whether the column automatically increments the value of the column for new rows added to the table. |
| setMaxLength(int value) | Sets the maximum length of a text column. |
| getMaxLength() | Gets the maximum length of a text column. |
| getCaption() | Gets the caption for the column. |
| setCaption(String value) | Sets the caption for the column. |
| getAutoIncrementSeed() | Gets the starting value for a column that has its getAutoIncrement() / setAutoIncrement(boolean) property set to true. |
| setAutoIncrementSeed(long value) | Sets the starting value for a column that has its getAutoIncrement() / setAutoIncrement(boolean) property set to true. |
| getAutoIncrementStep() | Gets the increment used by a column with its getAutoIncrement() / setAutoIncrement(boolean) property set to true. |
| setAutoIncrementStep(long value) | Sets the increment used by a column with its getAutoIncrement() / setAutoIncrement(boolean) property set to true. |
| setReadOnly(boolean value) | Sets a value that indicates whether the column allows for changes as soon as a row has been added to the table. |
| isReadOnly() | |
| getReadOnly() | Gets a value that indicates whether the column allows for changes as soon as a row has been added to the table. |
| getUnique() | Gets a value that indicates whether the values in each row of the column must be unique. |
| isUnique() | |
| setUnique(boolean value) | Sets a value that indicates whether the values in each row of the column must be unique. |
| getExpression() | Gets the expression used to filter rows, calculate the values in a column, or create an aggregate column. |
| areColumnSetsTheSame(DataColumn[] columnSet, DataColumn[] compareSet) | |
| toString() | Gets the getExpression() of the column, if one exists. |
public DataColumn()
Initializes a new instance of a DataColumn class as type string.
public DataColumn(String columnName)
Inititalizes a new instance of the DataColumn class, as type string, using the specified column name.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnName | java.lang.String | A string that represents the name of the column to be created. If set to null or an empty string (""), a default name will be specified when added to the columns collection. |
public DataColumn(String name, DataTable table)
Initializes a new instance of the @{link DataColumn} class using the specified column name and table it belongs to.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| name | java.lang.String | name of the DataColumn |
| table | DataTable | the table this column belongs to |
public DataColumn(String columnName, Class dataType)
Inititalizes a new instance of the DataColumn class using the specified column name and data type.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnName | java.lang.String | A string that represents the name of the column to be created. If set to null or an empty string (""), a default name will be specified when added to the columns collection. |
| dataType | java.lang.Class | A supported getDataType() / setDataType(java.lang.Class). |
public DataColumn(String name, Class type, DataTable table)
Initializes a new instance of the DataColumn class using the specified column name, data type and data table it belongs to.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| name | java.lang.String | name of the DataColumn |
| type | java.lang.Class | data type |
| table | DataTable | the table this column belongs to |
public final String getColumnName()
Gets the name of the column in the DataColumnCollection.
Returns: java.lang.String - The name of the column.
public final void setColumnName(String value)
Sets the name of the column in the DataColumnCollection.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | java.lang.String | The name of the column. |
public final boolean getAllowDBNull()
Gets a value that indicates whether null values are allowed in this column for rows that belong to the table.
Returns: boolean - true if null values values are allowed; otherwise, false. The default is true.
public final void setAllowDBNull(boolean value)
Sets a value that indicates whether null values are allowed in this column for rows that belong to the table.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | true if null values values are allowed; otherwise, false. The default is true. |
public final Class getDataType()
Gets the type of data stored in the column.
Returns: java.lang.Class - A java.lang.Class object that represents the column data type.
public final void setDataType(Class value)
Sets the type of data stored in the column.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | java.lang.Class | A java.lang.Class object that represents the column data type. |
public final void setDefaultValue(Object value)
Sets the default value for the column when you are creating new rows.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | java.lang.Object | A value appropriate to the column’s getDataType() / setDataType(java.lang.Class). |
public final Object getDefaultValue()
Gets the default value for the column when you are creating new rows.
Returns: java.lang.Object - A value appropriate to the column’s getDataType() / setDataType(java.lang.Class).
public final int getOrdinal()
Gets the position of the column in the DataColumnCollection collection.
Returns: int - The position of the column. Gets -1 if the column is not a member of a collection.
public final void setOrdinal(int ordinal)
Changes the ordinal or position of the DataColumn to the specified ordinal or position.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| ordinal | int | The specified ordinal. |
public final int getColumnMapping()
Gets the MappingType of the column.
Returns: int - One of the MappingType values. The returned value is one of MappingType constants.
public final void setColumnMapping(int value)
Sets the MappingType of the column.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | int | One of the MappingType values. The value must be one of MappingType constants. |
public final String getNamespace()
Gets the namespace of the DataColumn.
Returns: java.lang.String - The namespace of the DataColumn.
public final void setNamespace(String value)
Sets the namespace of the DataColumn.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | java.lang.String | The namespace of the DataColumn. |
public final String getPrefix()
Gets an XML prefix that aliases the namespace of the DataTable.
Returns: java.lang.String - The XML prefix for the DataTable namespace.
public final void setPrefix(String value)
Sets an XML prefix that aliases the namespace of the DataTable.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | java.lang.String | The XML prefix for the DataTable namespace. |
public final DataTable getTable()
Gets the DataTable to which the column belongs to.
Returns: DataTable - The DataTable that the DataColumn belongs to.
public final boolean getAutoIncrement()
Gets a value that indicates whether the column automatically increments the value of the column for new rows added to the table.
Returns: boolean - true if the value of the column increments automatically; otherwise, false. The default is false.
public final void setAutoIncrement(boolean value)
Sets a value that indicates whether the column automatically increments the value of the column for new rows added to the table.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | true if the value of the column increments automatically; otherwise, false. The default is false. |
public final void setMaxLength(int value)
Sets the maximum length of a text column.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | int | The maximum length of the column in characters. If the column has no maximum length, the value is -1 (default). |
public final int getMaxLength()
Gets the maximum length of a text column.
Returns: int - The maximum length of the column in characters. If the column has no maximum length, the value is -1 (default).
public final String getCaption()
Gets the caption for the column.
Returns: java.lang.String - The caption of the column. If not set, returns the getColumnName() / setColumnName(java.lang.String) value.
public final void setCaption(String value)
Sets the caption for the column.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | java.lang.String | The caption of the column. If not set, returns the getColumnName() / setColumnName(java.lang.String) value. |
public final long getAutoIncrementSeed()
Gets the starting value for a column that has its getAutoIncrement() / setAutoIncrement(boolean) property set to true.
Returns: long - The starting value for the getAutoIncrement() / setAutoIncrement(boolean) feature.
public final void setAutoIncrementSeed(long value)
Sets the starting value for a column that has its getAutoIncrement() / setAutoIncrement(boolean) property set to true.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | long | The starting value for the getAutoIncrement() / setAutoIncrement(boolean) feature. |
public final long getAutoIncrementStep()
Gets the increment used by a column with its getAutoIncrement() / setAutoIncrement(boolean) property set to true.
Returns: long - The number by which the value of the column is automatically incremented. The default is 1.
public final void setAutoIncrementStep(long value)
Sets the increment used by a column with its getAutoIncrement() / setAutoIncrement(boolean) property set to true.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | long | The number by which the value of the column is automatically incremented. The default is 1. |
public final void setReadOnly(boolean value)
Sets a value that indicates whether the column allows for changes as soon as a row has been added to the table.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | true if the column is read only; otherwise, false. The default is false. |
public final boolean isReadOnly()
Returns: boolean
public final boolean getReadOnly()
Gets a value that indicates whether the column allows for changes as soon as a row has been added to the table.
Returns: boolean - true if the column is read only; otherwise, false. The default is false.
public final boolean getUnique()
Gets a value that indicates whether the values in each row of the column must be unique.
Returns: boolean - true if the value must be unique; otherwise, false. The default is false.
public final boolean isUnique()
Returns: boolean
public final void setUnique(boolean value)
Sets a value that indicates whether the values in each row of the column must be unique.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | true if the value must be unique; otherwise, false. The default is false. |
public final String getExpression()
Gets the expression used to filter rows, calculate the values in a column, or create an aggregate column.
Returns: java.lang.String - An expression to calculate the value of a column, or create an aggregate column. The return type of an expression is determined by the getDataType() / setDataType(java.lang.Class) of the column.
public static boolean areColumnSetsTheSame(DataColumn[] columnSet, DataColumn[] compareSet)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnSet | DataColumn[] | |
| compareSet | DataColumn[] |
Returns: boolean
public final String toString()
Gets the getExpression() of the column, if one exists.
Returns: java.lang.String - The getExpression() value, if the property is set; otherwise, the getColumnName() / setColumnName(java.lang.String) property.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.