DataColumn

Inheritance: java.lang.Object

public final class DataColumn

Represents the schema of a column in a DataTable.

Constructors

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.

Methods

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.

DataColumn()

public DataColumn()

Initializes a new instance of a DataColumn class as type string.

DataColumn(String columnName)

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.

DataColumn(String name, DataTable table)

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

DataColumn(String columnName, Class dataType)

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).

DataColumn(String name, Class type, DataTable table)

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

getColumnName()

public final String getColumnName()

Gets the name of the column in the DataColumnCollection.

Returns: java.lang.String - The name of the column.

setColumnName(String value)

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.

getAllowDBNull()

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.

setAllowDBNull(boolean value)

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.

getDataType()

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.

setDataType(Class value)

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.

setDefaultValue(Object value)

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).

getDefaultValue()

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).

getOrdinal()

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.

setOrdinal(int ordinal)

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.

getColumnMapping()

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.

setColumnMapping(int value)

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.

getNamespace()

public final String getNamespace()

Gets the namespace of the DataColumn.

Returns: java.lang.String - The namespace of the DataColumn.

setNamespace(String value)

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.

getPrefix()

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.

setPrefix(String value)

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.

getTable()

public final DataTable getTable()

Gets the DataTable to which the column belongs to.

Returns: DataTable - The DataTable that the DataColumn belongs to.

getAutoIncrement()

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.

setAutoIncrement(boolean value)

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.

setMaxLength(int value)

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).

getMaxLength()

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).

getCaption()

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.

setCaption(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.

getAutoIncrementSeed()

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.

setAutoIncrementSeed(long value)

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.

getAutoIncrementStep()

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.

setAutoIncrementStep(long value)

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.

setReadOnly(boolean value)

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.

isReadOnly()

public final boolean isReadOnly()

Returns: boolean

getReadOnly()

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.

getUnique()

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.

isUnique()

public final boolean isUnique()

Returns: boolean

setUnique(boolean value)

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.

getExpression()

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.

areColumnSetsTheSame(DataColumn[] columnSet, DataColumn[] compareSet)

public static boolean areColumnSetsTheSame(DataColumn[] columnSet, DataColumn[] compareSet)

Parameters:

Parameter Type Description
columnSet DataColumn[]
compareSet DataColumn[]

Returns: boolean

toString()

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.