DataRelationCollection

Inheritance: java.lang.Object

All Implemented Interfaces: java.lang.Iterable

public class DataRelationCollection implements Iterable

Represents the collection of DataRelation objects for this DataSet.

Methods

MethodDescription
add(System.Data.DataColumn parentColumn, System.Data.DataColumn childColumn)Creates a DataRelation with a specified parent and child column, and adds it to the collection.
add(System.Data.DataRelation relation)Adds a DataRelation to the DataRelationCollection.
add(System.Data.DataTable parentTable, System.Data.DataTable childTable, String parentColumnName, String childColumnName)Adds a relation to the collection.
add(System.Data.DataTable parentTable, System.Data.DataTable childTable, String[] parentColumnNames, String[] childColumnNames)Adds a relation to the collection.
add(String name, System.Data.DataColumn parentColumn, System.Data.DataColumn childColumn)Creates a DataRelation with the specified name, and parent and child columns, and adds it to the collection.
add(String name, System.Data.DataColumn parentColumn, System.Data.DataColumn childColumn, boolean createConstraints)Creates a DataRelation with the specified name, parent and child columns, with optional constraints according to the value of the createConstraints parameter, and adds it to the collection.
clear()Clears the collection of any relations.
contains(System.Data.DataRelation relation)Verifies whether a DataRelation with the specific name (case insensitive) exists in the collection.
get(int index)Gets the DataRelation object at the specified index.
get(String name)Gets the DataRelation object specified by name.
getCount()
indexOf(System.Data.DataRelation relation)Gets the index of the specified DataRelation object.
iterator()
removeAt(int index)Removes the relation at the specified index from the collection.

add(System.Data.DataColumn parentColumn, System.Data.DataColumn childColumn)

public void add(System.Data.DataColumn parentColumn, System.Data.DataColumn childColumn)

Creates a DataRelation with a specified parent and child column, and adds it to the collection.

Parameters:

ParameterTypeDescription
parentColumnDataColumnThe parent column of the relation.
childColumnDataColumnThe child column of the relation.

add(System.Data.DataRelation relation)

public void add(System.Data.DataRelation relation)

Adds a DataRelation to the DataRelationCollection.

Parameters:

ParameterTypeDescription
relationDataRelationThe DataRelation to add to the collection.

add(System.Data.DataTable parentTable, System.Data.DataTable childTable, String parentColumnName, String childColumnName)

public void add(System.Data.DataTable parentTable, System.Data.DataTable childTable, String parentColumnName, String childColumnName)

Adds a relation to the collection. Performs no checks on the duplication etc.

Parameters:

ParameterTypeDescription
parentTableDataTableThe parent table of the relation.
childTableDataTableThe child table of the relation.
parentColumnNamejava.lang.StringThe parent column’s name of the relation.
childColumnNamejava.lang.StringThe child column’s name of the relation.

add(System.Data.DataTable parentTable, System.Data.DataTable childTable, String[] parentColumnNames, String[] childColumnNames)

public void add(System.Data.DataTable parentTable, System.Data.DataTable childTable, String[] parentColumnNames, String[] childColumnNames)

Adds a relation to the collection. Performs no checks on the duplication etc.

Parameters:

ParameterTypeDescription
parentTableDataTableThe parent table of the relation.
childTableDataTableThe child table of the relation.
parentColumnNamesjava.lang.String[]The array of parent column’s name of the relation.
childColumnNamesjava.lang.String[]The array of child column’s name of the relation.

add(String name, System.Data.DataColumn parentColumn, System.Data.DataColumn childColumn)

public void add(String name, System.Data.DataColumn parentColumn, System.Data.DataColumn childColumn)

Creates a DataRelation with the specified name, and parent and child columns, and adds it to the collection.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of the relation.
parentColumnDataColumnThe parent column of the relation.
childColumnDataColumnThe child column of the relation.

add(String name, System.Data.DataColumn parentColumn, System.Data.DataColumn childColumn, boolean createConstraints)

public void add(String name, System.Data.DataColumn parentColumn, System.Data.DataColumn childColumn, boolean createConstraints)

Creates a DataRelation with the specified name, parent and child columns, with optional constraints according to the value of the createConstraints parameter, and adds it to the collection.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of the relation.
parentColumnDataColumnThe parent column of the relation.
childColumnDataColumnThe child column of the relation.
createConstraintsbooleantrue to create constraints; otherwise false. (The default is true).

clear()

public void clear()

Clears the collection of any relations.

contains(System.Data.DataRelation relation)

public boolean contains(System.Data.DataRelation relation)

Verifies whether a DataRelation with the specific name (case insensitive) exists in the collection.

Parameters:

ParameterTypeDescription
relationDataRelationThe name of the relation to find.

Returns: boolean - true, if a relation with the specified name exists; otherwise false.

get(int index)

public System.Data.DataRelation get(int index)

Gets the DataRelation object at the specified index.

Parameters:

ParameterTypeDescription
indexintThe zero-based index to find.

Returns: DataRelation - The DataRelation, or a null value if the specified DataRelation does not exist.

get(String name)

public System.Data.DataRelation get(String name)

Gets the DataRelation object specified by name.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of the relation to find.

Returns: DataRelation - The named DataRelation, or a null value if the specified DataRelation does not exist.

getCount()

public int getCount()

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

indexOf(System.Data.DataRelation relation)

public int indexOf(System.Data.DataRelation relation)

Gets the index of the specified DataRelation object.

Parameters:

ParameterTypeDescription
relationDataRelationThe relation to search for.

Returns: int - The 0-based index of the relation, or -1 if the relation is not found in the collection.

iterator()

public Iterator iterator()

Returns: java.util.Iterator

removeAt(int index)

public void removeAt(int index)

Removes the relation at the specified index from the collection.

Parameters:

ParameterTypeDescription
indexintThe index of the relation to remove.