DataColumnCollection

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.

Methods

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.

add(DataColumn column)

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.

add(String columnName)

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.

add(String columnName, Class type)

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.

indexOf(String columnName)

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.

indexOf(DataColumn column)

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.

get(int index)

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.

get(String name)

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.

contains(String name)

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.

remove(String name)

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.

remove(DataColumn column)

public final void remove(DataColumn column)

Removes the specified DataColumn object from the collection.

Parameters:

Parameter Type Description
column DataColumn The DataColumn to remove.

getCount()

public final int getCount()

Returns: int - the total number of elements in a collection.

iterator()

public final Iterator iterator()

Returns: java.util.Iterator

clear()

public final void clear()

Clears the collection of any columns.