- All Superinterfaces:
AutoCloseable,Closeable
Supported column types:
- Simple objects —
String,BigInteger, andBigDecimal - Primitives —
int,double, etc - Boxed primitives —
Integer,Double, etc - Primitive arrays —
int[],double[], etc
IllegalArgumentException to be thrown. The column definition must be annotated with @Nullable to support nulls.
The actual row implementation class is generated at runtime, and the standard
equals, hashCode, toString, and clone methods are automatically
generated as well. If the row interface declares a clone method which returns the
exact row type, then the row can be cloned without requiring an explicit cast. If the row
interface extends Comparable, then rows are comparable by primary key. Any default
methods defined in the row interface are never overridden by the generated class, unless the
method is defined in the Object class.
Scans over the rows of the table can be reduced by a query, described by this syntax:
Query = RowFilter | Projection [ RowFilter ] RowFilter = AndFilter { "||" AndFilter } AndFilter = EntityFilter { "&&" EntityFilter } EntityFilter = ColumnFilter | ParenFilter ParenFilter = [ "!" ] "(" RowFilter ")" ColumnFilter = ColumnName RelOp ( ArgRef | ColumnName ) | ColumnName "in" ArgRef RelOp = "==" | "!=" | ">=" | "<" | "<=" | ">" Projection = "{" ProjColumns "}" ProjColumns = [ ProjColumn { "," ProjColumn } ] ProjColumn = ( ( ( ( "+" | "-" ) [ "!" ] ) | "~" ) ColumnName ) | "*" ColumnName = string ArgRef = "?" [ uint ]
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns a new row instance which is an exact copy of the given row.voidclose()comparator(String spec) Returns a row comparator based on the given specification, which defines the ordering columns.voidCopies all columns and states from one row to another.booleandelete(Transaction txn, R row) Unconditionally removes an existing row by primary key.exchange(Transaction txn, R row) Unconditionally stores the given row, potentially replacing a corresponding row which already exists.booleanexists(Transaction txn, R row) Checks if a row exists by searching against the primary key.booleaninsert(Transaction txn, R row) Stores the given row when a corresponding row doesn't exist.booleanisClosed()booleanisEmpty()Non-transactionally determines if the table has nothing in it.booleanload(Transaction txn, R row) Fully loads the row by primary key.booleanmerge(Transaction txn, R row) Updates an existing row with the modified columns of the given row, and then loads the result back into the given row.newRow()Returns a new row instance with unset columns.newScanner(Transaction txn) Returns a new scanner for all rows of this table.newScanner(Transaction txn, String query, Object... args) Returns a new scanner for a subset of rows from this table, as specified by the query expression.newStream(Transaction txn) Returns a new stream for all rows of this table.newStream(Transaction txn, String query, Object... args) Returns a new stream for a subset of rows from this table, as specified by the query expression.newTransaction(DurabilityMode durabilityMode) Returns a new transaction which is compatible with this table.newUpdater(Transaction txn) Returns a new updater for all rows of this table.newUpdater(Transaction txn, String query, Object... args) Returns a new updater for a subset of rows from this table, as specified by the query expression.Returns a row predicate for the given query expression and arguments.booleanreplace(Transaction txn, R row) Stores the given row when a corresponding row already exists.rowType()Returns the interface which defines the rows of this table.scannerPlan(Transaction txn, String query, Object... args) Returns a query plan used bynewScanner.voidstore(Transaction txn, R row) Unconditionally stores the given row, potentially replacing a corresponding row which already exists.default QueryPlanstreamPlan(Transaction txn, String query, Object... args) Returns a query plan used bynewStream.voidResets the state of the given row such that all columns are unset.booleanupdate(Transaction txn, R row) Updates an existing row with the modified columns of the given row, but the resulting row isn't loaded back.updaterPlan(Transaction txn, String query, Object... args) Returns a query plan used bynewUpdater.
-
Method Details
-
rowType
Returns the interface which defines the rows of this table. -
newRow
R newRow()Returns a new row instance with unset columns. -
cloneRow
Returns a new row instance which is an exact copy of the given row. -
unsetRow
Resets the state of the given row such that all columns are unset. -
copyRow
Copies all columns and states from one row to another. -
newScanner
Returns a new scanner for all rows of this table.- Parameters:
txn- optional transaction for the scanner to use; pass null for auto-commit mode- Returns:
- a new scanner positioned at the first row in the table
- Throws:
IllegalStateException- if transaction belongs to another database instanceIOException- See Also:
-
newScanner
Returns a new scanner for a subset of rows from this table, as specified by the query expression.- Parameters:
txn- optional transaction for the scanner to use; pass null for auto-commit mode- Returns:
- a new scanner positioned at the first row in the table accepted by the query
- Throws:
IllegalStateException- if transaction belongs to another database instanceIOException- See Also:
-
newUpdater
Returns a new updater for all rows of this table.When providing a transaction which acquires locks (or the transaction is null), upgradable locks are acquired for each row visited by the updater. If the transaction lock mode is non-repeatable, any lock acquisitions for rows which are stepped over are released when moving to the next row. Updates with a null transaction are auto-committed and become visible to other transactions as the updater moves along.
- Parameters:
txn- optional transaction for the updater to use; pass null for auto-commit mode- Returns:
- a new updater positioned at the first row in the table
- Throws:
IllegalStateException- if transaction belongs to another database instanceIOException- See Also:
-
newUpdater
Returns a new updater for a subset of rows from this table, as specified by the query expression.When providing a transaction which acquires locks (or the transaction is null), upgradable locks are acquired for each row visited by the updater. If the transaction lock mode is non-repeatable, any lock acquisitions for rows which are stepped over are released when moving to the next row. Updates with a null transaction are auto-committed and become visible to other transactions as the updater moves along.
- Parameters:
txn- optional transaction for the updater to use; pass null for auto-commit mode- Returns:
- a new updater positioned at the first row in the table accepted by the query
- Throws:
IllegalStateException- if transaction belongs to another database instanceIOException- See Also:
-
newStream
Returns a new stream for all rows of this table. The stream must be explicitly closed when no longer used, or else it must be used with a try-with-resources statement. If an underlyingIOExceptionis generated, it's thrown as if it was unchecked.- Parameters:
txn- optional transaction for the stream to use; pass null for auto-commit mode- Returns:
- a new stream positioned at the first row in the table
- Throws:
IllegalStateException- if transaction belongs to another database instance- See Also:
-
newStream
Returns a new stream for a subset of rows from this table, as specified by the query expression. The stream must be explicitly closed when no longer used, or else it must be used with a try-with-resources statement. If an underlyingIOExceptionis generated, it's thrown as if it was unchecked.- Parameters:
txn- optional transaction for the stream to use; pass null for auto-commit mode- Returns:
- a new stream positioned at the first row in the table accepted by the query
- Throws:
IllegalStateException- if transaction belongs to another database instance- See Also:
-
newTransaction
Returns a new transaction which is compatible with this table. If the provided durability mode is null, a default mode is selected. -
isEmpty
Non-transactionally determines if the table has nothing in it. A return value of true guarantees that the table is empty, but false negatives are possible.- Throws:
IOException
-
load
Fully loads the row by primary key.- Returns:
- false if a corresponding row doesn't exist
- Throws:
IllegalStateException- if primary key isn't fully specifiedIOException
-
exists
Checks if a row exists by searching against the primary key. This method should be called only if the row doesn't need to be loaded or stored — calling exists and then calling a load or store method is typically less efficient than skipping the exists check entirely.- Returns:
- false if a corresponding row doesn't exist
- Throws:
IllegalStateException- if primary key isn't fully specifiedIOException
-
store
Unconditionally stores the given row, potentially replacing a corresponding row which already exists.- Throws:
IllegalStateException- if any required columns aren't setUniqueConstraintException- if a conflicting alternate key existsIOException
-
exchange
Unconditionally stores the given row, potentially replacing a corresponding row which already exists.- Returns:
- a copy of the replaced row, or null if none existed
- Throws:
IllegalStateException- if any required columns aren't setUniqueConstraintException- if a conflicting alternate key existsIOException
-
insert
Stores the given row when a corresponding row doesn't exist.- Returns:
- false if a corresponding row already exists and nothing was inserted
- Throws:
IllegalStateException- if any required columns aren't setUniqueConstraintException- if a conflicting alternate key existsIOException
-
replace
Stores the given row when a corresponding row already exists.- Returns:
- false if a corresponding row doesn't exist
- Throws:
IllegalStateException- if any required columns aren't setUniqueConstraintException- if a conflicting alternate key existsIOException
-
update
Updates an existing row with the modified columns of the given row, but the resulting row isn't loaded back.- Returns:
- false if a corresponding row doesn't exist
- Throws:
IllegalStateException- if primary key isn't fully specifiedUniqueConstraintException- if a conflicting alternate key existsIOException
-
merge
Updates an existing row with the modified columns of the given row, and then loads the result back into the given row.- Returns:
- false if a corresponding row doesn't exist
- Throws:
IllegalStateException- if primary key isn't fully specifiedUniqueConstraintException- if a conflicting alternate key existsIOException
-
delete
Unconditionally removes an existing row by primary key.- Returns:
- false if a corresponding row doesn't exist
- Throws:
IllegalStateException- if primary key isn't fully specifiedIOException
-
comparator
Returns a row comparator based on the given specification, which defines the ordering columns. Each column name is prefixed with '+' or '-', to indicate ascending or descending order. For example:"+lastName+firstName-birthdate". By default, nulls are treated as higher non-nulls, but a '!' after the '+'/'-' character causes nulls to be treated as lower than non-nulls.- Throws:
IllegalArgumentException- if the specification is malformedIllegalStateException- if the specification refers to non-existent columns
-
predicate
Returns a row predicate for the given query expression and arguments. -
scannerPlan
Returns a query plan used bynewScanner.- Parameters:
txn- optional transaction to be used; pass null for auto-commit modequery- optional query expressionargs- optional query arguments- Throws:
IOException
-
updaterPlan
Returns a query plan used bynewUpdater.- Parameters:
txn- optional transaction to be used; pass null for auto-commit modequery- optional query expressionargs- optional query arguments- Throws:
IOException
-
streamPlan
Returns a query plan used bynewStream.- Parameters:
txn- optional transaction to be used; pass null for auto-commit modequery- optional query expressionargs- optional query arguments- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- See Also:
-
isClosed
boolean isClosed()
-