APIdia Launch Partner
Top Description Fields Constructors Methods
io.github.spannm.jackcess.util

public final Class Joiner

extends Object
Class Inheritance
Imports
io.github.spannm.jackcess.CursorBuilder, .Index, .IndexCursor, .Row, .Table, io.github.spannm.jackcess.impl.DatabaseImpl, .IndexImpl, java.io.IOException, java.util.Collection, .Collections, .Iterator, .List, .Map

Utility for finding rows based on pre-defined, foreign-key table relationships.

Field Summary

Modifier and TypeField and Description
private final Object[]
private final List<? extends Index.Column>
private final Index
private final IndexCursor

Constructor Summary

AccessConstructor and Description
private
Joiner(Index fromIndex, IndexCursor toCursor)

Method Summary

Modifier and TypeMethod and Description
public static Joiner
create(Table
the "from" side of the relationship
fromTable
,
Table
the "to" side of the relationship
toTable
)

Creates a new Joiner based on the foreign-key relationship between the given "from"" table and the given "to"" table.

public static Joiner
create(Index
the index backing one side of a foreign-key relationship
fromIndex
)

Creates a new Joiner based on the given index which backs a foreign-key relationship.

public Joiner
createReverse()

Creates a new Joiner that is the reverse of this Joiner (the "from" and "to" tables are swapped).

public boolean

Returns:

true if any "to" rows were deleted, false otherwise
deleteRows
(Map<String, ?>
row from the "from" table (which must include the relevant columns for this join relationship)
fromRow
)

Deletes any rows in the "to" table based on the given columns in the "from" table.

public boolean

Returns:

true if any "to" rows were deleted, false otherwise
deleteRows
(Object[]
row from the "from" table (which must include the relevant columns for this join relationship)
fromRow
)

Deletes any rows in the "to" table based on the given columns in the "from" table.

private static boolean
deleteRowsImpl(Iterator<Row> iter)

Deletes all the rows and returns whether or not any "to"" rows were deleted.

public Row
findFirstRow(Map<String, ?>
row from the "from" table (which must include the relevant columns for this join relationship)
fromRow
)

Returns the first row in the "to" table based on the given columns in the "from" table if any, null if there is no matching row.

public Row
findFirstRow(Map<String, ?>
row from the "from" table (which must include the relevant columns for this join relationship)
fromRow
,
Collection<String>
desired columns in the from table row
columnNames
)

Returns selected columns from the first row in the "to" table based on the given columns in the "from" table if any, null if there is no matching row.

public EntryIterableBuilder
findRows(Map<String, ?>
row from the "from" table (which must include the relevant columns for this join relationship)
fromRow
)

Returns an Iterator over all the rows in the "to" table based on the given columns in the "from" table.

public EntryIterableBuilder
findRows(Object[]
row from the "from" table (which must include the relevant columns for this join relationship)
fromRow
)

Returns an Iterator with the selected columns over all the rows in the "to" table based on the given columns in the "from" table.

public List<? extends Index.Column>
public Index
public Table
public IndexCursor
public Index
public Table
public boolean
hasRows(Map<String, ?> fromRow)

Returns true if the "to" table has any rows based on the given columns in the "from" table, false otherwise.

public boolean
hasRows(Object[] fromRow)

Returns true if the "to" table has any rows based on the given columns in the "from" table, false otherwise.

private void
toEntryValues(Map<String, ?> fromRow)

Fills in the entryValues with the relevant info from the given "from" table row.

private void
toEntryValues(Object[] fromRow)

Fills in the entryValues with the relevant info from the given "from" table row.

public String
toFKString()

Returns a pretty string describing the foreign key relationship backing this Joiner.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

entryValuesback to summary
private final Object[] entryValues
fromColsback to summary
private final List<? extends Index.Column> fromCols
fromIndexback to summary
private final Index fromIndex
toCursorback to summary
private final IndexCursor toCursor

Constructor Detail

Joinerback to summary
private Joiner(Index fromIndex, IndexCursor toCursor)

Method Detail

createback to summary
public static Joiner create(Table fromTable, Table toTable) throws IOException

Creates a new Joiner based on the foreign-key relationship between the given "from"" table and the given "to"" table.

Parameters
fromTable:Table

the "from" side of the relationship

toTable:Table

the "to" side of the relationship

Exceptions
IllegalArgumentException:
if there is no relationship between the given tables
createback to summary
public static Joiner create(Index fromIndex) throws IOException

Creates a new Joiner based on the given index which backs a foreign-key relationship. The table of the given index will be the "from" table and the table on the other end of the relationship will be the "to" table.

Parameters
fromIndex:Index

the index backing one side of a foreign-key relationship

createReverseback to summary
public Joiner createReverse() throws IOException

Creates a new Joiner that is the reverse of this Joiner (the "from" and "to" tables are swapped).

deleteRowsback to summary
public boolean deleteRows(Map<String, ?> fromRow)

Deletes any rows in the "to" table based on the given columns in the "from" table.

Parameters
fromRow:Map<String, ?>

row from the "from" table (which must include the relevant columns for this join relationship)

Returns:boolean

true if any "to" rows were deleted, false otherwise

deleteRowsback to summary
public boolean deleteRows(Object[] fromRow)

Deletes any rows in the "to" table based on the given columns in the "from" table.

Parameters
fromRow:Object[]

row from the "from" table (which must include the relevant columns for this join relationship)

Returns:boolean

true if any "to" rows were deleted, false otherwise

deleteRowsImplback to summary
private static boolean deleteRowsImpl(Iterator<Row> iter)

Deletes all the rows and returns whether or not any "to"" rows were deleted.

findFirstRowback to summary
public Row findFirstRow(Map<String, ?> fromRow) throws IOException

Returns the first row in the "to" table based on the given columns in the "from" table if any, null if there is no matching row.

Parameters
fromRow:Map<String, ?>

row from the "from" table (which must include the relevant columns for this join relationship)

findFirstRowback to summary
public Row findFirstRow(Map<String, ?> fromRow, Collection<String> columnNames) throws IOException

Returns selected columns from the first row in the "to" table based on the given columns in the "from" table if any, null if there is no matching row.

Parameters
fromRow:Map<String, ?>

row from the "from" table (which must include the relevant columns for this join relationship)

columnNames:Collection<String>

desired columns in the from table row

findRowsback to summary
public EntryIterableBuilder findRows(Map<String, ?> fromRow)

Returns an Iterator over all the rows in the "to" table based on the given columns in the "from" table.

Parameters
fromRow:Map<String, ?>

row from the "from" table (which must include the relevant columns for this join relationship)

findRowsback to summary
public EntryIterableBuilder findRows(Object[] fromRow)

Returns an Iterator with the selected columns over all the rows in the "to" table based on the given columns in the "from" table.

Parameters
fromRow:Object[]

row from the "from" table (which must include the relevant columns for this join relationship)

getColumnsback to summary
public List<? extends Index.Column> getColumns()
getFromIndexback to summary
public Index getFromIndex()
getFromTableback to summary
public Table getFromTable()
getToCursorback to summary
public IndexCursor getToCursor()
getToIndexback to summary
public Index getToIndex()
getToTableback to summary
public Table getToTable()
hasRowsback to summary
public boolean hasRows(Map<String, ?> fromRow) throws IOException

Returns true if the "to" table has any rows based on the given columns in the "from" table, false otherwise.

hasRowsback to summary
public boolean hasRows(Object[] fromRow) throws IOException

Returns true if the "to" table has any rows based on the given columns in the "from" table, false otherwise.

toEntryValuesback to summary
private void toEntryValues(Map<String, ?> fromRow)

Fills in the entryValues with the relevant info from the given "from" table row.

Annotations
@SuppressWarnings:PMD.LinguisticNaming
toEntryValuesback to summary
private void toEntryValues(Object[] fromRow)

Fills in the entryValues with the relevant info from the given "from" table row.

Annotations
@SuppressWarnings:PMD.LinguisticNaming
toFKStringback to summary
public String toFKString()

Returns a pretty string describing the foreign key relationship backing this Joiner.