DataColumnCollection
Leave feedback
On this page
Inheritance: java.lang.Object
All Implemented Interfaces: java.lang.Iterable
public final class DataColumnCollection implements Iterable
Represents a collection of DataColumn objects for a DataTable.
| Method | Description |
|---|---|
| add(DataColumn column) | Creates and adds the specified DataColumn object to the DataColumnCollection. |
| add(String columnName) | Creates and adds a DataColumn object that has the specified name to the DataColumnCollection. |
| add(String columnName, Class type) | Creates and adds a DataColumn object that has the specified name and type to the DataColumnCollection. |
| add(String columnName, Class type, int columnMapping, boolean allowAutoIncrement, boolean allowDBNull) | Creates and adds a DataColumn with the specified name, type and specific values to the columns collection. |
| indexOf(String columnName) | Gets the index of the column with the specific name (the name is not case sensitive). |
| indexOf(DataColumn column) | Gets the index of a column specified by name. |
| get(int index) | Gets the DataColumn from the collection at the specified index. |
| get(String name) | Gets the DataColumn from the collection with the specified name. |
| contains(String name) | Checks whether the collection contains a column with the specified name. |
| remove(String name) | Removes the DataColumn object that has the specified name from the collection. |
| remove(DataColumn column) | Removes the specified DataColumn object from the collection. |
| getCount() | |
| iterator() | |
| clear() | Clears the collection of any columns. |
public final void add(DataColumn column)
Creates and adds the specified DataColumn object to the DataColumnCollection.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | DataColumn | The DataColumn to add. |
public final void add(String columnName)
Creates and adds a DataColumn object that has the specified name to the DataColumnCollection.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnName | java.lang.String | The name of the column. |
public final DataColumn add(String columnName, Class type)
Creates and adds a DataColumn object that has the specified name and type to the DataColumnCollection.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnName | java.lang.String | The DataColumn.getColumnName() / DataColumn.setColumnName(java.lang.String) to use when you create the column. |
| type | java.lang.Class | The DataColumn.getDataType() / DataColumn.setDataType(java.lang.Class) of the new column. |
Returns: DataColumn - The newly created DataColumn.
add(String columnName, Class type, int columnMapping, boolean allowAutoIncrement, boolean allowDBNull)
public final DataColumn add(String columnName, Class type, int columnMapping, boolean allowAutoIncrement, boolean allowDBNull)
Creates and adds a DataColumn with the specified name, type and specific values to the columns collection.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnName | java.lang.String | name |
| type | java.lang.Class | data type |
| columnMapping | int | column mapping type |
| allowAutoIncrement | boolean | is auto increment allowed |
| allowDBNull | boolean | is DBNull value allowed |
Returns: DataColumn - created a DataColumn instance.
public final int indexOf(String columnName)
Gets the index of the column with the specific name (the name is not case sensitive).
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnName | java.lang.String | The name of the column to find. |
Returns: int - The zero-based index of the column with the specified name, or -1 if the column does not exist in the collection.
public final int indexOf(DataColumn column)
Gets the index of a column specified by name.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | DataColumn | The name of the column to return. |
Returns: int - The index of the column specified by column if it is found; otherwise, -1.
public final DataColumn get(int index)
Gets the DataColumn from the collection at the specified index.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| index | int | The zero-based index of the column to return. |
Returns: DataColumn - The DataColumn at the specified index.
public final DataColumn get(String name)
Gets the DataColumn from the collection with the specified name.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| name | java.lang.String | The DataColumn.getColumnName() / DataColumn.setColumnName(java.lang.String) of the column to return. |
Returns: DataColumn - The DataColumn in the collection with the specified DataColumn.getColumnName() / DataColumn.setColumnName(java.lang.String); otherwise a null value if the DataColumn does not exist.
public final boolean contains(String name)
Checks whether the collection contains a column with the specified name.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| name | java.lang.String | The DataColumn.getColumnName() / DataColumn.setColumnName(java.lang.String) of the column to look for. |
Returns: boolean - true if a column exists with this name; otherwise, false.
public final void remove(String name)
Removes the DataColumn object that has the specified name from the collection.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| name | java.lang.String | The name of the column to remove. |
public final void remove(DataColumn column)
Removes the specified DataColumn object from the collection.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | DataColumn | The DataColumn to remove. |
public final int getCount()
Returns: int - the total number of elements in a collection.
public final Iterator iterator()
Returns: java.util.Iterator
public final void clear()
Clears the collection of any columns.
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.