public class Joiner
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.lang.Object[] |
_entryValues |
private java.util.List<? extends Index.Column> |
_fromCols |
private Index |
_fromIndex |
private IndexCursor |
_toCursor |
| Modifier | Constructor and Description |
|---|---|
private |
Joiner(Index fromIndex,
IndexCursor toCursor) |
| Modifier and Type | Method and Description |
|---|---|
static Joiner |
create(Index fromIndex)
Creates a new Joiner based on the given index which backs a foreign-key
relationship.
|
static Joiner |
create(Table fromTable,
Table toTable)
Creates a new Joiner based on the foreign-key relationship between the
given "from"" table and the given "to"" table.
|
Joiner |
createReverse()
Creates a new Joiner that is the reverse of this Joiner (the "from" and
"to" tables are swapped).
|
boolean |
deleteRows(java.util.Map<java.lang.String,?> fromRow)
Deletes any rows in the "to" table based on the given columns in the
"from" table.
|
boolean |
deleteRows(java.lang.Object[] fromRow)
Deletes any rows in the "to" table based on the given columns in the
"from" table.
|
private static boolean |
deleteRowsImpl(java.util.Iterator<Row> iter)
Deletes all the rows and returns whether or not any "to"" rows were
deleted.
|
Row |
findFirstRow(java.util.Map<java.lang.String,?> 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. |
Row |
findFirstRow(java.util.Map<java.lang.String,?> fromRow,
java.util.Collection<java.lang.String> 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. |
EntryIterableBuilder |
findRows(java.util.Map<java.lang.String,?> fromRow)
Returns an Iterator over all the rows in the "to" table based on the
given columns in the "from" table.
|
EntryIterableBuilder |
findRows(java.lang.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.
|
java.util.List<? extends Index.Column> |
getColumns() |
Index |
getFromIndex() |
Table |
getFromTable() |
IndexCursor |
getToCursor() |
Index |
getToIndex() |
Table |
getToTable() |
boolean |
hasRows(java.util.Map<java.lang.String,?> fromRow)
Returns
true if the "to" table has any rows based on the given
columns in the "from" table, false otherwise. |
boolean |
hasRows(java.lang.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(java.util.Map<java.lang.String,?> fromRow)
Fills in the _entryValues with the relevant info from the given "from"
table row.
|
private void |
toEntryValues(java.lang.Object[] fromRow)
Fills in the _entryValues with the relevant info from the given "from"
table row.
|
java.lang.String |
toFKString()
Returns a pretty string describing the foreign key relationship backing
this Joiner.
|
private final Index _fromIndex
private final java.util.List<? extends Index.Column> _fromCols
private final IndexCursor _toCursor
private final java.lang.Object[] _entryValues
private Joiner(Index fromIndex, IndexCursor toCursor)
public static Joiner create(Table fromTable, Table toTable) throws java.io.IOException
fromTable - the "from" side of the relationshiptoTable - the "to" side of the relationshipjava.lang.IllegalArgumentException - if there is no relationship between the
given tablesjava.io.IOExceptionpublic static Joiner create(Index fromIndex) throws java.io.IOException
fromIndex - the index backing one side of a foreign-key relationshipjava.io.IOExceptionpublic Joiner createReverse() throws java.io.IOException
java.io.IOExceptionpublic Table getFromTable()
public Index getFromIndex()
public Table getToTable()
public Index getToIndex()
public IndexCursor getToCursor()
public java.util.List<? extends Index.Column> getColumns()
public boolean hasRows(java.util.Map<java.lang.String,?> fromRow)
throws java.io.IOException
true if the "to" table has any rows based on the given
columns in the "from" table, false otherwise.java.io.IOExceptionpublic boolean hasRows(java.lang.Object[] fromRow)
throws java.io.IOException
true if the "to" table has any rows based on the given
columns in the "from" table, false otherwise.java.io.IOExceptionpublic Row findFirstRow(java.util.Map<java.lang.String,?> fromRow) throws java.io.IOException
null if there is no matching row.fromRow - row from the "from" table (which must include the relevant
columns for this join relationship)java.io.IOExceptionpublic Row findFirstRow(java.util.Map<java.lang.String,?> fromRow, java.util.Collection<java.lang.String> columnNames) throws java.io.IOException
null if there is no
matching row.fromRow - row from the "from" table (which must include the relevant
columns for this join relationship)columnNames - desired columns in the from table rowjava.io.IOExceptionpublic EntryIterableBuilder findRows(java.util.Map<java.lang.String,?> fromRow)
fromRow - row from the "from" table (which must include the relevant
columns for this join relationship)public EntryIterableBuilder findRows(java.lang.Object[] fromRow)
fromRow - row from the "from" table (which must include the relevant
columns for this join relationship)public boolean deleteRows(java.util.Map<java.lang.String,?> fromRow)
throws java.io.IOException
fromRow - row from the "from" table (which must include the relevant
columns for this join relationship)true if any "to" rows were deleted, false
otherwisejava.io.IOExceptionpublic boolean deleteRows(java.lang.Object[] fromRow)
throws java.io.IOException
fromRow - row from the "from" table (which must include the relevant
columns for this join relationship)true if any "to" rows were deleted, false
otherwisejava.io.IOExceptionprivate static boolean deleteRowsImpl(java.util.Iterator<Row> iter) throws java.io.IOException
java.io.IOExceptionprivate void toEntryValues(java.util.Map<java.lang.String,?> fromRow)
private void toEntryValues(java.lang.Object[] fromRow)
public java.lang.String toFKString()